Skip to content

Commit

Permalink
Increase delay between retries using exponential backoff
Browse files Browse the repository at this point in the history
  • Loading branch information
joselcvarela committed Jul 10, 2023
1 parent d04c916 commit ac6cf31
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class Plugin {
}

if (count > 0) {
await sleep(randInt(1000, 8000));
await sleep(Math.pow(2, count) * 1000);
}
}

Expand Down Expand Up @@ -346,10 +346,6 @@ function warning(message) {
Log.warning(message);
}

function randInt(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}

function sleep(ms) {
return new Promise((res) => setTimeout(res, ms));
}
Expand Down

0 comments on commit ac6cf31

Please sign in to comment.