Retries a job

@param int $backOffTime
@return boolean
325032
public function retry($backOffTime = null)
    {
        $retry = $this->getRetry();

        // Log the retry
        $this->queue->getClient()->getRedis()->hset(\date('Y-m-d') . '_retry', (string)\time(), \json_encode([
            'class' => $this->getWorkerClass(),
            'args' => $this->getArgs(),
            'retry' => \gettype($retry) === 'boolean' ? (bool)$retry : (int)($retry - 1),
            'priority' => (float)$this->getPriority(),
            'id' => $this->getId()
        ]));

        return $this->queue->push(
            $this->getWorkerClass(),
            $this->getArgs(),
            \gettype($retry) === 'boolean' ? (bool)$retry : (int)($retry - 1),
            (float)$this->getPriority(),
            \time() + $backOffTime ?? 0,
            $this->getId()
        );
    }
902476
public function enqueue(Job $job, \DateTime $notBefore = null)
    {
        $attributes = $this->backend->enqueue($this->serializeJob($job), $notBefore);
        return $this->deserializeJob($attributes);
    }
181401
@Override
  public void retry(VolleyError error) throws VolleyError {
    currentRetryCount++;
    currentTimeoutMs += (currentTimeoutMs * backoffMultiplier);
    if (!hasAttemptRemaining()) {
      throw error;
    }
  }
723097
private static function buildRetryDecider()
    {
        return function (
            $retries,
            \GuzzleHttp\Psr7\Request $request,
            \GuzzleHttp\Psr7\Response $response = null,
            \GuzzleHttp\Exception\RequestException $exception = null
        ) {
            if ($retries >= self::MAX_AUTOMATIC_TIMEOUT_RETRIES) {
                return false;
            }

            if (!self::isConnectionError($exception) && !self::isRetryableServerError($response)) {
                return false;
            }

            if ($request->getMethod() == "GET" || $request->getMethod() == "PUT") {
                return true;
            }

            $path = $request->getUri()->getPath();

            if ($request->getMethod() == "POST") {
                if (!preg_match(self::ACTIONS_PATH_REGEX, $path)) {
                    return true;
                }
            }

            return false;
        };
    }
613553
def reconnect_backoff(attempt)
      if attempt > 16
        backoff = RECONNECT_BACKOFF
      else
        backoff = [RECONNECT_BACKOFF, CONNECT_INTERVAL * 2 ** attempt].min
      end

      backoff *= rand
    end
343887
public function reset($queue)
    {
        if (!function_exists('posix_getsid')) {
            throw JobConfigurationException::create('Function posix_getsid don\'t exists');
        }

        $configurations = $this->configurationManager->findPotentialDeadJobs($queue);

        foreach ($configurations as $configuration) {
            if ($this->restoreManager->reset($configuration)) {
                return true;
            }
        }

        return false;
    }
196791
def get_backoff_time(self):
        
        # We want to consider only the last consecutive errors sequence (Ignore redirects).
        consecutive_errors_len = len(list(takewhile(lambda x: x.redirect_location is None,
                                                    reversed(self.history))))
        if consecutive_errors_len <= 1:
            return 0

        backoff_value = self.backoff_factor * (2 ** (consecutive_errors_len - 1))
        return min(self.BACKOFF_MAX, backoff_value)
168803
public function perform(Resque_Job $job)
    {
        $startTime = microtime(true);
        try {
            Resque_Event::trigger('afterFork', $job);
            $job->perform();
            $this->log(array('message' => 'done ID:' . $job->payload['id'], 'data' => array('type' => 'done', 'job_id' => $job->payload['id'], 'time' => round(microtime(true) - $startTime, 3) * 1000)), self::LOG_TYPE_INFO);
        } catch (Exception $e) {
            $this->log(array('message' => $job . ' failed: ' . $e->getMessage(), 'data' => array('type' => 'fail', 'log' => $e->getMessage(), 'job_id' => $job->payload['id'], 'time' => round(microtime(true) - $startTime, 3) * 1000)), self::LOG_TYPE_ERROR);
            $job->fail($e);
            return;
        }

        $job->updateStatus(Resque_Job_Status::STATUS_COMPLETE);
    }
836301
protected function reconnect()
    {
        if ($this->connection->inTransaction()) {
            // It is not safe to blindly reconnect in the middle of a transaction
            return false;
        }

        try {
            // Make sure we free any resources associated with the old connection
            $this->connection->disconnect();
        } catch (Exception $e) {
        }

        try {
            $this->connection->connect();
            $this->connection->log('[RECONNECT]');

            return true;
        } catch (Exception $e) {
            // If there was an error connecting again, don't report it back,
            // let the retry handler do it.
            return false;
        }
    }
751781
def backoff(error_class, retry_limit=9, &block)
      next_sleep = BACKOFF_INITIAL_SLEEP
      begin
        yield
      rescue error_class
        raise if retry_limit == 0
        sleep(next_sleep)
        next_sleep *= 2
        retry_limit -= 1
        retry
      end
    end
1341431
public RetryInterceptorBuilder<T> backOffOptions(long initialInterval,
			double multiplier, long maxInterval) {
		Assert.isNull(this.retryOperations,
				"cannot set the back off policy when a custom retryOperations has been set");
		Assert.isTrue(!this.backOffPolicySet,
				"cannot set the back off options when a back off policy has been set");
		ExponentialBackOffPolicy policy = new ExponentialBackOffPolicy();
		policy.setInitialInterval(initialInterval);
		policy.setMultiplier(multiplier);
		policy.setMaxInterval(maxInterval);
		this.retryTemplate.setBackOffPolicy(policy);
		this.backOffOptionsSet = true;
		this.templateAltered = true;
		return this;
	}
773355
public RetryTemplateBuilder fixedBackoff(long interval) {
		Assert.isNull(this.backOffPolicy, "You have already selected backoff policy");
		Assert.isTrue(interval >= 1, "Interval should be >= 1");
		FixedBackOffPolicy policy = new FixedBackOffPolicy();
		policy.setBackOffPeriod(interval);
		this.backOffPolicy = policy;
		return this;
	}
412606
protected function retryJob($job)
    {
        $this->laravel['queue']->connection($job->connection)->pushRaw(
            $this->resetAttempts($job->payload), $job->queue
        );
    }
1216331
synchronized void scheduleRetry(long retryInterval)
    {
        // Synchronized to insure a destroyed or cancelled (ivTaskHanler=null)
        // timer is not re-scheduled. If the timer is in the cancelled state
        // but not yet destroyed, then reset the expiration back to the last
        // expiration since it was never completed successfully. If the cancel
        // does rollback then schedule will be called again and re-create the
        // task handler. The only side effect of this is that the retry count
        // is reset; so the timer may experience more retries than configured. RTC107334

        if (!ivDestroyed)
        {
            if (ivTaskHandler != null)
            {
                ivTaskHandler.scheduleRetry(retryInterval);
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "scheduleRetry: not scheduled, timer in cancelled state : " + ivTaskId);
                ivExpiration = ivLastExpiration;
            }
        }
    }
1354683
public function setOptions(array $options) : BackoffInterface
    {
        $this->options = array_merge($this->options, $options);

        return $this;
    }
49928
private function _pauseOnRetry($retries)
    {
        if ($retries <= $this->_config['MaxErrorRetry']) {
            $delay = (int) (pow(4, $retries) * 100000);
            usleep($delay);
            return true;
        } 
        return false;
    }
889254
protected function addJobToRetrySet($job, $retryAt)
    {
        return (bool)$this->client->zadd(
            $this->getRetryZsetNameWithPrefix($job->getQueue()),
            $retryAt,
            serialize($job)
        );
    }