CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
delay.base.js45 linesDownload Raw Back to delay
1"use strict";2Object.defineProperty(exports, "__esModule", { value: true });3var jitter_factory_1 = require("../jitter/jitter.factory");4var Delay = /** @class */ (function () {5    function Delay(options) {6        this.options = options;7        this.attempt = 0;8    }9    Delay.prototype.apply = function () {10        var _this = this;11        return new Promise(function (resolve) { return setTimeout(resolve, _this.jitteredDelay); });12    };13    Delay.prototype.setAttemptNumber = function (attempt) {14        this.attempt = attempt;15    };16    Object.defineProperty(Delay.prototype, "jitteredDelay", {17        get: function () {18            var jitter = jitter_factory_1.JitterFactory(this.options);19            return jitter(this.delay);20        },21        enumerable: true,22        configurable: true23    });24    Object.defineProperty(Delay.prototype, "delay", {25        get: function () {26            var constant = this.options.startingDelay;27            var base = this.options.timeMultiple;28            var power = this.numOfDelayedAttempts;29            var delay = constant * Math.pow(base, power);30            return Math.min(delay, this.options.maxDelay);31        },32        enumerable: true,33        configurable: true34    });35    Object.defineProperty(Delay.prototype, "numOfDelayedAttempts", {36        get: function () {37            return this.attempt;38        },39        enumerable: true,40        configurable: true41    });42    return Delay;43}());44exports.Delay = Delay;45//# sourceMappingURL=delay.base.js.map
basant307/AI_Governance_Project · CoolFace