protected function shouldRetry()

in src/Utils/ExponentialBackoff.php [121:139]


    protected function shouldRetry(\Exception $exception)
    {
        if ($this->retryAttempt < $this->retries) {
            if (!$this->retryFunction) {
                $this->retryAttempt++;
                return true;
            }
            if (call_user_func($this->retryFunction, $exception)) {
                $this->retryAttempt++;
                return true;
            }
        }

        if ($this->backoff && $this->backoff->shouldRetry($exception)) {
            return true;
        }

        return false;
    }