Batch queue
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user