UNPKG

@itwin/imodels-client-management

Version:

iModels API client wrapper for applications that manage iModels.

24 lines 1.05 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.ExponentialBackoffAlgorithm = void 0; /** * Exponential backoff algorithm for calculating sleep time after a failed HTTP request. * Default implementation for {@link BackoffAlgorithm}. */ class ExponentialBackoffAlgorithm { _baseDelayInMs; _factor; constructor(params) { this._baseDelayInMs = params.baseDelayInMs; this._factor = params.factor; } getSleepDurationInMs(attempt) { return Math.pow(this._factor, attempt) * this._baseDelayInMs; } } exports.ExponentialBackoffAlgorithm = ExponentialBackoffAlgorithm; //# sourceMappingURL=ExponentialBackoffAlgorithm.js.map