Example #1
0
 /**
  * If slave synchronous syncing is enabled (@see self::OPT_SLAVES_SYNC_ENABLED) then this method ensures
  * that @see self::OPT_SLAVES_SYNC_REQUIRED_COUNT number of slaves will acknowledge all issued commands
  * within @see self::OPT_SLAVES_SYNC_TIMEOUT. If syncing is enabled and slaves fail to acknowledge the issued
  * commands then an exception is thrown
  */
 protected function waitForSlaveSync()
 {
     if ($this->options[self::OPT_SLAVES_SYNC_ENABLED]) {
         $synced = $this->redis->wait($this->options[self::OPT_SLAVES_SYNC_REQUIRED_COUNT], $this->options[self::OPT_SLAVES_SYNC_TIMEOUT]);
         if ($synced < $this->options[self::OPT_SLAVES_SYNC_REQUIRED_COUNT]) {
             throw new Exception\NotEnoughSlavesSynced(sprintf('Required: %d, synced: %d', $this->options[self::OPT_SLAVES_SYNC_REQUIRED_COUNT], $synced));
         }
     }
 }