Эх сурвалжийг харах

Disconnect before eventually throwing exception.

Daniele Alessandri 9 жил өмнө
parent
commit
0c99f9ef28

+ 3 - 3
src/Connection/Aggregate/SentinelReplication.php

@@ -639,13 +639,13 @@ class SentinelReplication implements ReplicationInterface
             try {
             try {
                 $response = $this->getConnection($command)->$method($command);
                 $response = $this->getConnection($command)->$method($command);
             } catch (CommunicationException $exception) {
             } catch (CommunicationException $exception) {
+                $this->wipeServerList();
+                $exception->getConnection()->disconnect();
+
                 if ($retries == $this->retryLimit) {
                 if ($retries == $this->retryLimit) {
                     throw $exception;
                     throw $exception;
                 }
                 }
 
 
-                $this->wipeServerList();
-                $exception->getConnection()->disconnect();
-
                 usleep($this->retryWait * 1000);
                 usleep($this->retryWait * 1000);
 
 
                 ++$retries;
                 ++$retries;