コード例 #1
0
ファイル: Request.php プロジェクト: khelle/surume
 /**
  * @param PromiseInterface $promise
  */
 protected function retry(PromiseInterface $promise)
 {
     if ($this->counter >= $this->params['retriesLimit']) {
         $promise->reject(new LazyException(new TimeoutException('No response was received during specified timeout.')));
     } else {
         if ($this->params['retriesInterval'] > 0) {
             $this->counter++;
             $this->channel->getLoop()->addTimer($this->params['retriesInterval'], function () use($promise) {
                 $this->send($promise);
             });
         } else {
             $this->counter++;
             $this->channel->getLoop()->afterTick(function () use($promise) {
                 $this->send($promise);
             });
         }
     }
 }