public function testBackoffDelay()
 {
     for ($i = 0; $i < 100; $i++) {
         $this->assertLessThanOrEqual(16, Util::backoffDelay(1));
         $this->assertLessThanOrEqual(256, Util::backoffDelay(5));
     }
 }
 /**
  * @param \Exception $e exception caught
  * @param int $errors number of errors
  * @param Maintenance $out
  * @param string $messagePrefix
  * @param string $description
  */
 public function sleepOnRetry(\Exception $e, $errors, $messagePrefix, $description)
 {
     $type = get_class($e);
     $seconds = Util::backoffDelay($errors);
     $message = ElasticsearchIntermediary::extractMessage($e);
     $this->outputIndented($messagePrefix . "Caught an error {$description}.  " . "Backing off for {$seconds} and retrying.  Error type is '{$type}' and message is:  {$message}\n");
     sleep($seconds);
 }