fix(updater): revert IA bullshit
Some checks are pending
/ test (push) Waiting to run

This commit is contained in:
Florian Schmitt 2025-03-27 15:01:29 +03:00
parent 1fcf0bf1da
commit cf8bf9a9cf

View file

@ -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) {
$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";
}
}