/ set distributed retries count and delay
331311
function SetRetries ( $count, $delay=0 )
    {
        assert ( is_int($count) && $count>=0 );
        assert ( is_int($delay) && $delay>=0 );
        $this->_retrycount = $count;
        $this->_retrydelay = $delay;
    }
312332
function rimrafWithRetries(...args) {
    let retries = 0;
    return new Promise((resolve, reject) => {
        function rm(...rmArgs) {
            try {
                rimraf.sync(...rmArgs);
                resolve();
            } catch (e) {
                retries += 1;
                if (retries < 5) {
                    setTimeout(() => {
                        rm(...rmArgs);
                    }, 100);
                } else {
                    reject(e);
                }
            }
        }
        rm(...args);
    });
}
591451
function(chain) {
    const retryAttempts = 100
      , timerInterval = 5000
      , chainTimer = {timer: undefined, blockNumber: 0, retryCounter: 0}
      , provider = (chain == 'utility' ? web3UtilityProvider : web3ValueProvider)
    ;
    return new Promise(function (onResolve, onReject) {
      chainTimer['timer'] = setInterval(function () {
        if (chainTimer['retryCounter'] <= retryAttempts) {
          provider.eth.getBlockNumber(function (err, blocknumber) {
            if (err) {
            } else {
              if (chainTimer['blockNumber']!=0 && chainTimer['blockNumber']!=blocknumber) {
                logger.info("* Geth Checker - " + chain + " chain has new blocks.");
                clearInterval(chainTimer['timer']);
                onResolve();
              }
              chainTimer['blockNumber'] = blocknumber;
            }
          });
        } else {
          logger.error("Geth Checker - " + chain + " chain has no new blocks.");
          onReject();
          process.exit(1);
        }
        chainTimer['retryCounter']++;
      }, timerInterval);
    });
  }
239117
def retry(self, queue=None, delay=None, max_retries=None):
        

        max_retries = max_retries
        if max_retries is None:
            max_retries = self.max_retries

        if self.data.get("retry_count", 0) >= max_retries:
            raise MaxRetriesInterrupt()

        exc = RetryInterrupt()

        exc.queue = queue or self.queue or self.data.get("queue") or "default"
        exc.retry_count = self.data.get("retry_count", 0) + 1
        exc.delay = delay
        if exc.delay is None:
            exc.delay = self.retry_delay

        self._attach_original_exception(exc)

        raise exc
83131
public void setChainStartRetryAttempts(Object value) throws NumberFormatException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Setting chain start retry attempts [" + value + "]");
        }
        try {
            int num = MetatypeUtils.parseInteger(PROPERTY_CONFIG_ALIAS, PROPERTY_CHAIN_START_RETRY_ATTEMPTS, value, chainStartRetryAttempts);
            if (-1 <= num) {
                this.chainStartRetryAttempts = num;
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Value too low");
                }
            }
        } catch (NumberFormatException nfe) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Vaue is not a number");
            }
        }
    }
1345226
def retry(self, func, partition_id, retry_message, final_failure_message, max_retries, host_id):
        
        loop = asyncio.new_event_loop()
        loop.run_until_complete(self.retry_async(func, partition_id, retry_message,
                                                 final_failure_message, max_retries, host_id))
62838
public void setRepeatTimerDelay(int delay)
    {
        if (delay <= 0)
        {
            String message = Logging.getMessage("generic.ArgumentOutOfRange", delay);
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }
        this.repeatTimer.setDelay(delay);
    }
910047
public final void setGuaranteedRemoteGetWaitTime(long value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setGuaranteedRemoteGetWaitTime", Long.valueOf(value));
        getHdr2().setLongField(JsHdr2Access.GUARANTEEDREMOTEGET_SET_WAITTIME, value);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setGuaranteedRemoteGetWaitTime");
    }
524233
public function retryLater($delay) {
        $this->runUpdate("
            UPDATE " . self::$jobsTable . "
            SET run_at = DATE_ADD(NOW(), INTERVAL ? SECOND),
                attempts = attempts + 1
            WHERE id = ?",
            array(
              $delay,
              $this->job_id
            )
        );
        $this->releaseLock();
    }
908552
private ExponentialRetryAlgorithm createRetryAlgorithm(ApiClock clock) {
    long timeoutMs = retryOptions.getMaxElapsedBackoffMillis();

    Deadline deadline = getOperationCallOptions().getDeadline();
    if (deadline != null) {
      timeoutMs = deadline.timeRemaining(TimeUnit.MILLISECONDS);
    }

    RetrySettings retrySettings = RetrySettings.newBuilder()

        .setJittered(true)

        // How long should the sleep be between RPC failure and the next RPC retry?
        .setInitialRetryDelay(toDuration(retryOptions.getInitialBackoffMillis()))

        // How fast should the retry delay increase?
        .setRetryDelayMultiplier(retryOptions.getBackoffMultiplier())

        // What is the maximum amount of sleep time between retries?
        // There needs to be some sane number for max retry delay, and it's unclear what that
        // number ought to be.  1 Minute time was chosen because some number is needed.
        .setMaxRetryDelay(Duration.of(1, ChronoUnit.MINUTES))

        // How long should we wait before giving up retries after the first failure?
        .setTotalTimeout(toDuration(timeoutMs))

        .build();
    return new ExponentialRetryAlgorithm(retrySettings, clock);
  }
656444
public function retry(int $delayed = 0) : void
    {
        $this->link->req($this->id(), $delayed);
    }
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);
				}
557984
def retry(
        transport: 'UDPTransport',
        messagedata: bytes,
        message_id: UDPMessageID,
        recipient: Address,
        stop_event: Event,
        timeout_backoff: Iterable[int],
) -> bool:
    

    async_result = transport.maybe_sendraw_with_result(
        recipient,
        messagedata,
        message_id,
    )

    event_quit = event_first_of(
        async_result,
        stop_event,
    )

    for timeout in timeout_backoff:

        if event_quit.wait(timeout=timeout) is True:
            break

        log.debug(
            'retrying message',
            node=pex(transport.raiden.address),
            recipient=pex(recipient),
            msgid=message_id,
        )

        transport.maybe_sendraw_with_result(
            recipient,
            messagedata,
            message_id,
        )

    return async_result.ready()
111918
function(args, callback, cache, retryCount){
        retryCount = retryCount || 0;
        concurrentUp();
        googleapis.analytics('v3').data.ga.get(args, function(err, result) {
            concurrentDown();
            if(err) {
                //  403 error: we probably just need to wait 1 sec...
                if(err.code === 403) {
                    setTimeout(function(){
                        if(retryCount < concurrentMaxRetry) {
                            retryCount += 1;
                            gaExecuteQuery.apply(this, [args, callback, cache, retryCount]);
                        } else {
                            //  Give up
                            return callback(err);
                        }
                    }, concurrentDelay);
                    return;
                } else {
                    return callback(err);
                }
            }

            //  Cache the response, if caching is on
            if(cache ) {
                var fileName = getCacheFileName(args);
                fs.writeFileSync(fileName, JSON.stringify(result), {encoding: "utf8"});
            }

            callback(null, result);
        });
    }
788964
function retry() {
    if (!self.waitInterval) {
      setImmediate(function() {
        self._read(size);
      });
    } else {
      setTimeout(function() {
        self._read(size);
      }, self.waitInterval * Math.random()).unref();
    }
  }
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
581015
function syncRedis() {
    // if memStore has changed...
    if(JSON.stringify(memCache) !== JSON.stringify(memStore)) {
      return when.promise((resolve, reject) => {
        var serializedStore = JSON.stringify(memStore);
        redis.set(name, serializedStore, err => {
          if(err) {
            reject(err);
          } else {
            resolve(true);
          }
        });
      })
      .delay(syncInterval)
      .catch(err => {
        console.log(err.stack);
        return when(true);
      })
      .finally(() => {
        memCache = _.cloneDeep(memStore);
        if(active) syncRedis(memStore);
        return when(true);
      });
    }

    // else memStore has not changed...
    else {
      return when(true)
        .delay(syncInterval)
        .then(() => {
          if(active) syncRedis(memStore);
          return when(true);
        });
    }
  }