@deno/kv
Version:
A Deno KV client library optimized for Node.js.
7 lines (6 loc) • 311 B
JavaScript
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
export function _exponentialBackoffWithJitter(cap, base, attempt, multiplier, jitter) {
const exp = Math.min(cap, base * multiplier ** attempt);
return (1 - jitter * Math.random()) * exp;
}