backoff-rxjs
Version:
A collection of helpful RxJS operators to deal with backoff strategies (like exponential backoff)
12 lines (11 loc) • 441 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.exponentialBackoffDelay = exports.getDelay = void 0;
function getDelay(backoffDelay, maxInterval) {
return Math.min(backoffDelay, maxInterval);
}
exports.getDelay = getDelay;
function exponentialBackoffDelay(iteration, initialInterval) {
return Math.pow(2, iteration) * initialInterval;
}
exports.exponentialBackoffDelay = exponentialBackoffDelay;