Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const MIN_TIMEOUT = 1000;
- const FACTOR = 1.5;
- const ATTEMPTS = 22;
- const range = (n) => Array.apply(null, {length: n}).map(Number.call, Number);
- const timeout = (attempt) => Math.min(MIN_TIMEOUT * Math.pow(FACTOR, attempt), Infinity);
- const toSeconds = (ms) => Math.floor((ms / 1000));
- const retries = range(ATTEMPTS).map(attempt => toSeconds(timeout(attempt)));
- console.log(retries);
Add Comment
Please, Sign In to add comment