Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upper limit on the retry backoff #1599

Closed
1 task done
Tracked by #1684
Sytten opened this issue Feb 8, 2021 · 2 comments
Closed
1 task done
Tracked by #1684

Upper limit on the retry backoff #1599

Sytten opened this issue Feb 8, 2021 · 2 comments
Labels
enhancement This change will extend Got features good for beginner This issue is easy to fix ✭ help wanted ✭

Comments

@Sytten
Copy link

Sytten commented Feb 8, 2021

What problem are you trying to solve?

Currently there is no upper limit on the backoff, meaning it grows exponentially if you want many retries which is not something you might want.

Describe the feature

So I would add a new optional parameter to the retry object called backoffLimit that would be a number of milliseconds to wait maximum between retries. This would basically do a Math.min between the default calculated backoff value and this parameter value. This would allow a user to put a limit of say 10 and have the following behaviour:

Retry 1 2 3 4 5 6 7 8 9 10
Time 2s 4s 8s 16s 32s 60s 60s 60s 60s 60s

Checklist

  • I have read the documentation and made sure this feature doesn't already exist.
@sindresorhus
Copy link
Owner

sindresorhus commented Feb 8, 2021

Sounds ok to me, but I'll let other maintainers chime in too.

For now, you could provide your own calculateDelay function to achieve this.

@Sytten
Copy link
Author

Sytten commented Feb 8, 2021

Thanks! I know I can provide the method, but I didn't want to lose the checks it does for the header and there was no easy way to import the default calculate delay method.

@szmarczak szmarczak added enhancement This change will extend Got features ✭ help wanted ✭ good for beginner This issue is easy to fix labels Feb 8, 2021
@szmarczak szmarczak mentioned this issue Mar 21, 2021
71 tasks
@szmarczak szmarczak mentioned this issue Apr 13, 2021
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This change will extend Got features good for beginner This issue is easy to fix ✭ help wanted ✭
Projects
None yet
Development

No branches or pull requests

3 participants