How to use the retry.timeouts function in retry

To help you get started, we’ve selected a few retry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SOHU-Co / kafka-node / lib / consumerGroupRecovery.js View on Github external
ConsumerGroupRecovery.prototype.getRetryTimeout = function (error) {
  assert(error);
  if (!this._timeouts) {
    this._timeouts = retry.timeouts({
      retries: this.options.retries,
      factor: this.options.retryFactor,
      minTimeout: this.options.retryMinTimeout
    });
  }

  if (this._retryIndex == null || this.lastError == null || error.errorCode !== this.lastError.errorCode) {
    this._retryIndex = 0;
  }

  var index = this._retryIndex++;
  if (index >= this._timeouts.length) {
    return false;
  }
  return this._timeouts[index];
};

retry

Abstraction for exponential and custom retry strategies for failed operations.

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis

Popular retry functions