From cf8bf9a9cf262b7f0526fcd2d7c62b8b71e931b0 Mon Sep 17 00:00:00 2001 From: Florian Schmitt Date: Thu, 27 Mar 2025 15:01:29 +0300 Subject: [PATCH] fix(updater): revert IA bullshit --- utils.inc.php | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/utils.inc.php b/utils.inc.php index 126c1cf..5bfbf96 100644 --- a/utils.inc.php +++ b/utils.inc.php @@ -515,32 +515,17 @@ function searchWikis($path, $pattern, $depth = 1, $httpCheck = false) // Process HTTP requests in smaller batches to avoid overwhelming resources if (!empty($list) && $httpCheck) { try { - // Process in batches of 10 for better performance - $batchSize = 10; - $batches = array_chunk($list, $batchSize, true); - - foreach ($batches as $batch) { - $httpClient = HttpClientBuilder::buildDefault(); - $futures = []; - - foreach ($batch as $key => $item) { - if ($item['URL'] !== 'KO') { - $futures[$key] = Amp\async(fn () => $httpClient->request(new Request($item['URL'], 'HEAD'))); - } - } - - $responses = Amp\Future\awaitAll($futures); - - // Update statuses from responses - foreach ($responses[0] as $key => $error) { - $list[$key]['STATUS'] = 'ERROR'; - } - - foreach ($responses[1] as $key => $response) { - $list[$key]['STATUS'] = $response->getStatus() . ' ' . $response->getReason(); - } + $responses = Amp\Future\awaitAll(array_map(function ($l) use ($httpClient) { + return Amp\async(fn () => $httpClient->request(new Request($l['URL'], 'HEAD'))); + }, $list)); + foreach ($responses[0] as $key => $response) { + $list[$key]['STATUS'] = 'ERROR'; + } + foreach ($responses[1] as $key => $response) { + $list[$key]['STATUS'] = $response->getStatus() . ' ' . $response->getReason(); } } catch (Exception $e) { + // If any one of the requests fails the combo will fail echo $e->getMessage(), "\n"; } }