diff options
author | Nathan Gass | 2020-08-20 14:11:14 +0200 |
---|---|---|
committer | Nathan Gass | 2020-08-20 14:11:42 +0200 |
commit | cc48b1fb76da4258a5e697eaf2ac37c3d10ef44e (patch) | |
tree | 0ce3850e3e8c90b3dbf97cc4da36cd902fe20a9d | |
parent | 78deb2cd664fa20af429086cb5c327583d9b0a67 (diff) | |
download | itools-cc48b1fb76da4258a5e697eaf2ac37c3d10ef44e.tar.gz itools-cc48b1fb76da4258a5e697eaf2ac37c3d10ef44e.tar.bz2 itools-cc48b1fb76da4258a5e697eaf2ac37c3d10ef44e.zip |
only call handler after retries
-rw-r--r-- | it_url.class | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/it_url.class b/it_url.class index 8b2bd2b..6b1f81c 100644 --- a/it_url.class +++ b/it_url.class @@ -416,13 +416,13 @@ static function get_multi($p=null) if (!$p['noresults']) $results_unordered[$key] = $content; - if (is_array($urls[$key]) && ($handler = $urls[$key]['handler'])) - $abort = $handler($info['handle'], $content); - - if (it::match(self::$retryable, curl_getinfo($handles[$key], CURLINFO_RESPONSE_CODE)) && $retries[$key]++ < $p['retries']) + if (it::match(self::$retryable, curl_getinfo($handles[$key], CURLINFO_RESPONSE_CODE)) && $retries[$key]++ < $p['retries']) { $sleepuntils[$key] = microtime(true) + $p['retrysleep']; - else + } else { + if (is_array($urls[$key]) && ($handler = $urls[$key]['handler'])) + $abort = $handler($info['handle'], $content); unset($urls[$key]); + } $closehandle($key); } else if($retries[$key]++ < $p['retries']) { $closehandle($key); # closehandle must be called before addhandle as we use the same key |