UNPKG

airtable

Version:

The official Airtable JavaScript library.

14 lines 864 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var internal_config_json_1 = __importDefault(require("./internal_config.json")); // "Full Jitter" algorithm taken from https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ function exponentialBackoffWithJitter(numberOfRetries) { var rawBackoffTimeMs = internal_config_json_1.default.INITIAL_RETRY_DELAY_IF_RATE_LIMITED * Math.pow(2, numberOfRetries); var clippedBackoffTimeMs = Math.min(internal_config_json_1.default.MAX_RETRY_DELAY_IF_RATE_LIMITED, rawBackoffTimeMs); var jitteredBackoffTimeMs = Math.random() * clippedBackoffTimeMs; return jitteredBackoffTimeMs; } module.exports = exponentialBackoffWithJitter; //# sourceMappingURL=exponential_backoff_with_jitter.js.map