Przeglądaj źródła

Disconnect before eventually throwing exception.

Daniele Alessandri 9 lat temu
rodzic
commit
0c99f9ef28
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      src/Connection/Aggregate/SentinelReplication.php

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

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