diff --git a/src/Handler/CurlMultiHandler.php b/src/Handler/CurlMultiHandler.php index 9146ed01..01a19573 100644 --- a/src/Handler/CurlMultiHandler.php +++ b/src/Handler/CurlMultiHandler.php @@ -159,12 +159,11 @@ class CurlMultiHandler // pool only after the specified delay. if (empty($entry['options']['delay'])) { curl_multi_add_handle($this->_mh, $handle); - $this->tick(); + // Do the connection, but don't process any messages as that can + // lead to recursion. + while (curl_multi_exec($this->_mh, $this->active) === CURLM_CALL_MULTI_PERFORM); } elseif ($entry['options']['delay'] === true) { - $mh = $this->_mh; - P\trampoline()->schedule(static function () use ($handle, $mh) { - curl_multi_add_handle($mh, $handle); - }); + curl_multi_add_handle($this->_mh, $handle); } else { $this->delays[$id] = microtime(true) + ($entry['options']['delay'] / 1000); }