Explorar el Código

Prevent warnings picking slave from empty pool.

Daniele Alessandri hace 9 años
padre
commit
44ebf5a5e4
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      src/Connection/Aggregate/MasterSlaveReplication.php

+ 3 - 1
src/Connection/Aggregate/MasterSlaveReplication.php

@@ -207,7 +207,9 @@ class MasterSlaveReplication implements ReplicationInterface
      */
      */
     protected function pickSlave()
     protected function pickSlave()
     {
     {
-        return $this->slaves[array_rand($this->slaves)];
+        if ($this->slaves) {
+            return $this->slaves[array_rand($this->slaves)];
+        }
     }
     }
 
 
     /**
     /**