mirror of
https://github.com/predis/predis.git
synced 2026-09-07 08:58:33 +00:00
Prevent warnings picking slave from empty pool.
This commit is contained in:
@@ -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)];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user