vercel / async-retry

Retrying made simple, easy and async
https://npmjs.com/async-retry
MIT License
1.84k stars 52 forks source link

Set dynamic retry timeout in onRetry #101

Open linkyndy opened 1 year ago

linkyndy commented 1 year ago

I am currently trying to retry requests made to Notion. If I am rate limited, their API returns the number of seconds I should wait before retrying. I would like to use this value in onRetry (or anywhere else, though here it makes sense) to dynamically alter how long to wait before the next retry. If I am not mistaken, this kind of behaviour is not supported by async-retry at the moment.

vitaly-t commented 1 month ago

This one does that, you can use delay as a callback with it, and return the right delay value.