diff options
Diffstat (limited to 'it_url.class')
-rw-r--r-- | it_url.class | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/it_url.class b/it_url.class index 5e2b681..765a504 100644 --- a/it_url.class +++ b/it_url.class @@ -409,8 +409,7 @@ static function get_multi($p=null) $closehandle($key); } else if($retries[$key]++ < $p['retries']) { $closehandle($key); # closehandle must be called before addhandle as we use the same key - $addhandle($key, $urls[$key]); - $mrc = CURLM_CALL_MULTI_PERFORM; # force continue if this was last handle + $sleepuntils[$key] = microtime(true) + $p['retrysleep']; } else { $results_unordered[$key] = false; unset($urls[$key]); @@ -424,6 +423,16 @@ static function get_multi($p=null) } } } while ($mrc == CURLM_CALL_MULTI_PERFORM); + + foreach ((array)$sleepuntils as $key => $time) { + if (microtime(true) >= $time) { + $addhandle($key, $urls[$key]); + unset($sleepuntils[$key]); + } + $active = 1; + } + usleep($sleepuntils ? 100000 : 0); + $timeout = 0.1; # Longer delay to avoid busy loop but shorter than default of 1s in case we stil hit cURL 7.25.0 problem } |