Kraken\Channel\Extra\Request::retry PHP Method

retry() private method

private retry ( Kraken\Promise\PromiseInterface $promise )
$promise Kraken\Promise\PromiseInterface
    private function retry(PromiseInterface $promise)
    {
        if ($this->counter >= $this->params['retriesLimit']) {
            $promise->reject(new ThrowableProxy(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()->onTick(function () use($promise) {
                    $this->send($promise);
                });
            }
        }
    }