Open ungrim97 opened 2 years ago
There seems to have been an attempt to implement async/await for retry
: https://github.com/visionmedia/superagent/pull/1527
Looks like that PR got merged which will solve the issue I was having so I will close this issue
On second parse, it seems that the PR in #1527 were reverted so this ticket still needs to be open
Often when retrying a request it is useful to have a throttle back on the time between requests to prevent hitting the remote server in quick succession, but also to allow some time for potential issues to resolve.
I can see two potential ways that this could be easily handled in the .retry() function.
Accept an array of intervals in ms similar to the interface for
superagent-retyr-delay
. Each interval would be applied per request in orderSupport the returing of promises in the callback function passed to retry. This would allow much greater scope for functionionality including the ability for the user to await some timeout before returning true/false.
The later is my preferred option, but returning Promises in callbacks is a bit...urgh.
I believe I can implement either option as a PR if desired.