curl-client
curl-client copied to clipboard
Issue 55 curl multirunner burn cpu
Hi i'm running into this, any merge planned ? Any help needed ? We actually kickfixed like this ...
$status = curl_multi_exec($this->multiHandle, $active);
$info = curl_multi_info_read($this->multiHandle);
if (false !== $info) {
...
}else{
// fixing issue https://github.com/php-http/curl-client/issues/55
usleep(self::MULTI_RUNNER_USLEEP);
}
from https://github.com/elastic/elasticsearch-php/issues/990:
a solution proposed at https://bugs.php.net/bug.php?id=61141#1348321490 is
while ($active && $mrc == CURLM_OK) {
if (curl_multi_select($mh) == -1) usleep(100);
do { $mrc = curl_multi_exec($mh, $active); }
while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
(which we should format according to our code style, but functionality seems good to me. 100 micro seconds is 1 thousandst of a second, so should be an acceptable delay while lowering the cpu)