mirror of
https://github.com/predis/predis.git
synced 2026-08-30 04:02:22 +00:00
Force disconnection in Predis\Pipeline\StandardExecutor when a Predis\ServerException is thrown to prevent protocol desynchronization between the client and the server.
This commit is contained in:
+13
-6
@@ -1541,12 +1541,19 @@ class StandardExecutor implements IPipelineExecutor {
|
||||
foreach ($commands as $command) {
|
||||
$connection->writeCommand($command);
|
||||
}
|
||||
for ($i = 0; $i < $sizeofPipe; $i++) {
|
||||
$response = $connection->readResponse($commands[$i]);
|
||||
$values[] = $response instanceof \Iterator
|
||||
? iterator_to_array($response)
|
||||
: $response;
|
||||
unset($commands[$i]);
|
||||
try {
|
||||
for ($i = 0; $i < $sizeofPipe; $i++) {
|
||||
$response = $connection->readResponse($commands[$i]);
|
||||
$values[] = $response instanceof \Iterator
|
||||
? iterator_to_array($response)
|
||||
: $response;
|
||||
unset($commands[$i]);
|
||||
}
|
||||
}
|
||||
catch (\Predis\ServerException $exception) {
|
||||
// force disconnection to prevent protocol desynchronization
|
||||
$connection->disconnect();
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
return $values;
|
||||
|
||||
Reference in New Issue
Block a user