Disconnect before eventually throwing exception.

This commit is contained in:
Daniele Alessandri
2016-05-15 15:56:16 +02:00
parent 6e0743a29a
commit 0c99f9ef28
@@ -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;