Skip to content

Commit

Permalink
Merge pull request #45 from gregorg/fix_only_one_slave
Browse files Browse the repository at this point in the history
fix when there is 1 slave which is also the master
  • Loading branch information
gregorg authored Feb 7, 2018
2 parents e96c1c7 + c11ffb1 commit c37aa22
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Driver/Connection/MasterSlavesConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ public function connectToMaster($forced = null)
public function connectToSlave()
{
$this->forceMaster = false;
if ($this->currentConnectionParams !== null && $this->currentConnectionParams !== $this->master) {
if ($this->currentConnectionParams !== null // if connection exists
&& (
$this->currentConnectionParams !== $this->master // and is not a master
|| $this->currentConnectionParams === $this->currentSlave // or is current slave
)
) {
return;
}
$this->currentConnectionParams = null;
Expand Down

0 comments on commit c37aa22

Please sign in to comment.