forked from denoland/deno_std
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(async): remove _exponentialBackoffWithJitter from public file (d…
- Loading branch information
1 parent
8993c21
commit a3ddd35
Showing
3 changed files
with
16 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. | ||
// This module is browser compatible. | ||
|
||
export function _exponentialBackoffWithJitter( | ||
cap: number, | ||
base: number, | ||
attempt: number, | ||
multiplier: number, | ||
jitter: number, | ||
) { | ||
const exp = Math.min(cap, base * multiplier ** attempt); | ||
return (1 - jitter * Math.random()) * exp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters