Adding back-off during retries for REST handlerΒ #10571
Open
Description
Which application or package is this feature request for?
rest
Feature
I want to implement exponential back-off when a request is retried due to a 5xx or timeout error. However currently retries are always immediate, so I would need to set RESTOptions#retries
to 0 and then create a function like this:
await handleRetry(() => client.users.send(/* .. */));
// instead of
await client.users.send(/* .. */);
This is far from ideal, and it seems reasonable to implement this in the library instead.
Ideal solution or implementation
Adding to the RESTOptions
seems like the obvious choice.
Alternative solutions or implementations
No response
Other context
This was sparked by a question in the discord server.