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.
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 |
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.
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.
Most helpful comment
Sounds ok to me, but I'll let other maintainers chime in too.
For now, you could provide your own
calculateDelayfunction to achieve this.