UNPKG

@deno/kv

Version:

A Deno KV client library optimized for Node.js.

11 lines (10 loc) 500 B
"use strict"; // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // This module is browser compatible. Object.defineProperty(exports, "__esModule", { value: true }); exports._exponentialBackoffWithJitter = void 0; function _exponentialBackoffWithJitter(cap, base, attempt, multiplier, jitter) { const exp = Math.min(cap, base * multiplier ** attempt); return (1 - jitter * Math.random()) * exp; } exports._exponentialBackoffWithJitter = _exponentialBackoffWithJitter;