Batch queue

This commit is contained in:
Juan Pablo Vial
2025-06-30 15:52:28 -04:00
parent 5f4d8a4bc2
commit d4f8804fbb
29 changed files with 525 additions and 134 deletions

View File

@ -59,17 +59,29 @@ class FastCGI implements LoggerAwareInterface
public function awaitResponses(): array
{
$responses = [];
$repeats = 0;
$maxRepeats = count($this->socketIds);
while ($this->client->hasUnhandledResponses()) {
if ($repeats >= $maxRepeats) {
break;
}
try {
$readyResponses = $this->client->readReadyResponses(3000);
} catch (FCGI\Exceptions\FastCGIClientException $exception) {
$this->logger->error($exception->getMessage());
$repeats ++;
continue;
}
foreach ($readyResponses as $response) {
$responses []= $response;
$repeats ++;
}
}
if ($this->client->hasUnhandledResponses()) {
$this->logger->error("Unhandled responses");
return array_merge($responses, $this->awaitResponses());
}
return $responses;
}