UNPKG

nestjs-resilience

Version:

A module for improving the reliability and fault-tolerance of your NestJS applications

15 lines (14 loc) 468 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExponentialBackoff = void 0; const base_backoff_1 = require("./base.backoff"); class ExponentialBackoff extends base_backoff_1.Backoff { *getGenerator(maxRetries) { let attempt = 0; while (attempt < maxRetries) { yield this.baseDelay * Math.pow(2, attempt); attempt += 1; } } } exports.ExponentialBackoff = ExponentialBackoff;