summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Gass2020-08-20 14:11:14 +0200
committerNathan Gass2020-08-20 14:11:42 +0200
commitcc48b1fb76da4258a5e697eaf2ac37c3d10ef44e (patch)
tree0ce3850e3e8c90b3dbf97cc4da36cd902fe20a9d
parent78deb2cd664fa20af429086cb5c327583d9b0a67 (diff)
downloaditools-cc48b1fb76da4258a5e697eaf2ac37c3d10ef44e.tar.gz
itools-cc48b1fb76da4258a5e697eaf2ac37c3d10ef44e.tar.bz2
itools-cc48b1fb76da4258a5e697eaf2ac37c3d10ef44e.zip
only call handler after retries
-rw-r--r--it_url.class10
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