function CurlMultiHandler::tick
Ticks the curl event loop.
1 call to CurlMultiHandler::tick()
- CurlMultiHandler::execute in vendor/
guzzlehttp/ guzzle/ src/ Handler/ CurlMultiHandler.php - Runs until all outstanding connections have completed.
File
-
vendor/
guzzlehttp/ guzzle/ src/ Handler/ CurlMultiHandler.php, line 147
Class
- CurlMultiHandler
- Returns an asynchronous response using curl_multi_* functions.
Namespace
GuzzleHttp\HandlerCode
public function tick() : void {
// Add any delayed handles if needed.
if ($this->delays) {
$currentTime = Utils::currentTime();
foreach ($this->delays as $id => $delay) {
if ($currentTime >= $delay) {
unset($this->delays[$id]);
\curl_multi_add_handle($this->_mh, $this->handles[$id]['easy']->handle);
}
}
}
// Run curl_multi_exec in the queue to enable other async tasks to run
P\Utils::queue()->add(Closure::fromCallable([
$this,
'tickInQueue',
]));
// Step through the task queue which may add additional requests.
P\Utils::queue()->run();
if ($this->active && \curl_multi_select($this->_mh, $this->selectTimeout) === -1) {
// Perform a usleep if a select returns -1.
// See: https://bugs.php.net/bug.php?id=61141
\usleep(250);
}
while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM) {
// Prevent busy looping for slow HTTP requests.
\curl_multi_select($this->_mh, $this->selectTimeout);
}
$this->processMessages();
}