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

Prevent warnings picking slave from empty pool.

Daniele Alessandri 9 жил өмнө
parent
commit
5d99914939

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

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