-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bootstrap): handle HTTP 429 (#940)
- Loading branch information
Samuel Bodin
authored
Apr 18, 2022
1 parent
f623e99
commit 968046b
Showing
5 changed files
with
50 additions
and
28 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
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
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 |
---|---|---|
@@ -1,6 +1,15 @@ | ||
import { log } from './log'; | ||
|
||
// Coming in nodejs 16 | ||
export function wait(waitTime: number): Promise<void> { | ||
return new Promise((resolve) => { | ||
setTimeout(resolve, waitTime); | ||
}); | ||
} | ||
|
||
export async function backoff(retry: number, pow: number): Promise<void> { | ||
// retry backoff | ||
const bo = Math.pow(retry + 1, pow) * 1000; | ||
log.info('Retrying (', retry, '), waiting for', bo); | ||
await wait(bo); | ||
} |
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