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 // Process HTTP requests in smaller batches to avoid overwhelming resources
if (!empty($list) && $httpCheck) { if (!empty($list) && $httpCheck) {
try { try {
// Process in batches of 10 for better performance $responses = Amp\Future\awaitAll(array_map(function ($l) use ($httpClient) {
$batchSize = 10; return Amp\async(fn () => $httpClient->request(new Request($l['URL'], 'HEAD')));
$batches = array_chunk($list, $batchSize, true); }, $list));
foreach ($responses[0] as $key => $response) {
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'; $list[$key]['STATUS'] = 'ERROR';
} }
foreach ($responses[1] as $key => $response) { foreach ($responses[1] as $key => $response) {
$list[$key]['STATUS'] = $response->getStatus() . ' ' . $response->getReason(); $list[$key]['STATUS'] = $response->getStatus() . ' ' . $response->getReason();
} }
}
} catch (Exception $e) { } catch (Exception $e) {
// If any one of the requests fails the combo will fail
echo $e->getMessage(), "\n"; echo $e->getMessage(), "\n";
} }
} }