From cc48b1fb76da4258a5e697eaf2ac37c3d10ef44e Mon Sep 17 00:00:00 2001 From: Nathan Gass Date: Thu, 20 Aug 2020 14:11:14 +0200 Subject: only call handler after retries --- it_url.class | 10 +++++----- 1 file 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 -- cgit v1.2.3