mirror of
https://git.joinfirefish.org/firefish/firefish.git
synced 2024-05-19 02:01:12 +02:00
chore (minor): use ** in lieu of Math.pow
This commit is contained in:
parent
488323cc8e
commit
2760e7feee
|
@ -34,7 +34,7 @@ export function initialize<T>(name: string, limitPerSec = -1) {
|
|||
function apBackoff(attemptsMade: number, err: Error) {
|
||||
const baseDelay = 60 * 1000; // 1min
|
||||
const maxBackoff = 8 * 60 * 60 * 1000; // 8hours
|
||||
let backoff = (Math.pow(2, attemptsMade) - 1) * baseDelay;
|
||||
let backoff = (2 ** attemptsMade - 1) * baseDelay;
|
||||
backoff = Math.min(backoff, maxBackoff);
|
||||
backoff += Math.round(backoff * Math.random() * 0.2);
|
||||
return backoff;
|
||||
|
|
Loading…
Reference in a new issue