How many times to retry if the intial attempt fails?
348278
public HttpRequestBuilder withRetries(int n) {
    Preconditions.checkArg(n >= 0, "number of retries must be >= 0");
    this.numAttempts = n + 1;
    entry.withMaxAttempts(numAttempts);
    return this;
  }
1205098
function _try() {
            // Call function

            Q.invoke(f)
            .then(function(result) {
                // Success
                d.resolve(result);
            }, function(err) {
                // Failure

                // Decrement
                remainingTries -= 1;

                // No tries left, so reject promise with last error
                if(remainingTries >= 0 && canContinue(err, N - remainingTries)) {
                    // We have some retries left, so retryTimeout
                    if(retryTimeout) {
                        setTimeout(_try, retryTimeout);
                    } else {
                        _try();
                    }
                } else {
                    // Total failure
                    d.reject(err);
                    return;
                }
            }).done();
        }
276122
def reset_for_retry(self):
    """"""
    self.retries += 1
    self.last_work_item = ""
    self.active = True
    self.result_status = None
    self.input_finished = False
    self.counters_map = CountersMap()
    self.slice_id = 0
    self.slice_start_time = None
    self.slice_request_id = None
    self.slice_retries = 0
    self.acquired_once = False
100212
function(error) {
          logger.entry('Client._tryService.tryNextService', _id);

          if (serviceList.length === 1) {
            // We've tried all services without success. Pause for a while
            // before trying again
            logger.log('data', _id, 'End of service list');

            client._setState(STATE_RETRYING);
            var retry = function() {
              logger.entryLevel('entry_often', 'Client._tryService.retry', _id);
              if (!client.isStopped()) {
                process.nextTick(function() {
                  client._performConnect(false, true);
                });
              }
              logger.exitLevel('exit_often', 'Client._tryService.retry',
                               _id, null);
            };

            client._retryCount++;
            var retryCap = 60000;
            // Limit to the power of 8 as anything above this will put the
            // interval higher than the cap straight away.
            var exponent = (client._retryCount <= 8) ? client._retryCount : 8;
            var upperBound = Math.pow(2, exponent);
            var lowerBound = 0.75 * upperBound;
            var jitter = Math.random() * (0.25 * upperBound);
            var interval = Math.min(retryCap, (lowerBound + jitter) * 1000);
            // times by CONNECT_RETRY_INTERVAL for unittest purposes
            interval = Math.round(interval) * CONNECT_RETRY_INTERVAL;
            logger.log('data', _id, 'trying to connect again ' +
                       'after ' + (interval / 1000) + ' seconds');
            setTimeout(retry, interval);
            if (error) {
              setImmediate(function() {
                logger.log('emit', _id, 'error', error);
                client.emit('error', error);
              });
            }
          } else {
            // Try the next service in the list
            logger.log('data', _id, 'Trying next service');
            client._tryService(serviceList.slice(1));
          }

          logger.exit('Client._tryService.tryNextService', _id, null);
        }
401144
function retry(fn) {

  return function retried() {

    var args = arguments.length ? Array.prototype.slice.call(arguments, 0, arguments.length - 1) : [];
    var done = arguments.length ? arguments[arguments.length - 1] : noop;

    var cfn = null;
    var canceled = false;

    function exec() {
      var err = arguments[0];
      if (!err || canceled) {
        done.apply(null, arguments);
      } else {
        cfn = fn.apply(null, args);
      }
    }

    args.push(exec);
    exec(true);

    return function cancel() {
      canceled = true;
      cfn.apply(null, arguments);
    };

  };

}
817505
def retry_count(self, retries):
        
        if not isinstance(retries, int):
            raise TypeError("retries must be an integer")

        old_retries, self.retries = self.retries, retries
        try:
            yield
        finally:
            self.retries = old_retries
181401
@Override
  public void retry(VolleyError error) throws VolleyError {
    currentRetryCount++;
    currentTimeoutMs += (currentTimeoutMs * backoffMultiplier);
    if (!hasAttemptRemaining()) {
      throw error;
    }
  }
52574
def _eintr_retry(func, *args):
    """"""
    while True:
        try:
            return func(*args)
        except (OSError, select.error) as e:
            if e.args[0] != errno.EINTR:
                raise
176132
def retry(tries, delay=0, back_off=1, raise_msg=''):
    

    if back_off < 1:
        raise ValueError('back_off must be 1 or greater')

    tries = math.floor(tries)
    if tries < 0:
        raise ValueError('tries must be 0 or greater')

    if delay < 0:
        raise ValueError('delay must be 0 or greater')

    def deco_retry(f):
        def f_retry(*args, **kwargs):
            max_tries, max_delay = tries, delay  # make mutable

            while max_tries > 0:
                rv = f(*args, **kwargs)  # first attempt
                if rv:  # Done on success
                    return rv

                max_tries -= 1  # consume an attempt
                time.sleep(max_delay)  # wait...
                max_delay *= back_off  # make future wait longer
            else:
                if raise_msg:
                    raise Exception(raise_msg)
                return

        return f_retry  # true decorator -> decorated function

    return deco_retry
658012
def _handle_retryable_error(self, e, retry_count):
        """"""
        if isinstance(e, error.RateLimitEnforcedError):
            time.sleep(e.retry_after)
        else:
            time.sleep(self.RETRY_DELAY * (self.RETRY_BACKOFF ** retry_count))
314637
function retryOrError(){ 
					if (bRetrying)
						throw Error("unit hash verification failed, unit: "+unit+", objUnit: "+JSON.stringify(objUnit));
					console.log("unit hash verification failed, will retry");
					return setTimeout(function(){
						readJointDirectly(conn, unit, callbacks, true);
					}, 60*1000);
				}
456961
def retry(self):
        """"""
        self.stream = None
        self.config.loop.call_later(RETRY_TIMER, self.start)
        _LOGGER.debug('Reconnecting to %s', self.config.host)
606638
def number_of_retries(num)
      raise ArgumentError, 'Must be positive Integer' unless num.is_a?(Integer) && num.positive?
      self.retries = num
    end
1350848
function retry(count) {
    if (count === void 0) {
        count = -1;
    }
    return function (source) { return source.lift(new RetryOperator(count, source)); };
}
70723
function retrySameUrl(error, options, callback) {

    if (options.currentRetries <= options.retries) {

        log.warn({"url" : options.url, "step" : "queue-requester.recrawlUrl", "message" : "Recrawl -  retries : " + options.currentRetries});
        options.crawlWithDelay = true;

        //TODO : async this code
        // Reinject the same request in the queue
        // 1. Remove it from the crawl history in order to support the option skipDuplicates = true
        store.getStore().removeFromHistory(options.url);
        // 2. Add it again in the queue with the same options
        queue(options, callback);

    }
    else {

      onCrawl(error, options, function(error){
        process.nextTick(function() {callback(error);});
      });
    }


  }
669464
def retry_until_ok(func, *args, **kwargs):
    
    max_tries = 120
    for i in range(max_tries):
        try:
            return func(*args, **kwargs)
        except RuntimeError:
            # Do not mask RuntimeError.
            raise
        except errors.OperationFailure as exc:
            if exc.code == 13 or (  # MongoDB >= 2.6 sets the error code,
                exc.details
                and "unauthorized" == exc.details.get("errmsg")  # MongoDB 2.4 does not.
            ):
                # Do not mask authorization failures.
                raise
            if i == max_tries - 1:
                LOG.exception(
                    "Call to %s failed too many times in " "retry_until_ok", func
                )
                raise
        except Exception:
            if i == max_tries - 1:
                LOG.exception(
                    "Call to %s failed too many times in " "retry_until_ok", func
                )
                raise
        time.sleep(1)
961356
def retry_on_exception(num_retries, base_delay=0, exc_type=Exception):
    
    def _retry_on_exception_inner_1(f):
        def _retry_on_exception_inner_2(*args, **kwargs):
            retries = num_retries
            multiplier = 1
            while True:
                try:
                    return f(*args, **kwargs)
                except exc_type:
                    if not retries:
                        raise

                delay = base_delay * multiplier
                multiplier += 1
                log("Retrying '%s' %d more times (delay=%s)" %
                    (f.__name__, retries, delay), level=INFO)
                retries -= 1
                if delay:
                    time.sleep(delay)

        return _retry_on_exception_inner_2

    return _retry_on_exception_inner_1