mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat: add ClientOptions#retryLimit (#2805)
* feat: add ClientOptions#retryLimit * hydra needs to learn how to code right * a default would probably help * move incrementor & update comment * clarify docs on Infinity
This commit is contained in:
@@ -150,13 +150,13 @@ class RequestHandler {
|
||||
await Util.delayFor(this.retryAfter);
|
||||
return this.run();
|
||||
} else if (res.status >= 500 && res.status < 600) {
|
||||
// Retry once for possible serverside issues
|
||||
if (item.retried) {
|
||||
// Retry the specified number of times for possible serverside issues
|
||||
if (item.retries === this.manager.client.options.retryLimit) {
|
||||
return reject(
|
||||
new HTTPError(res.statusText, res.constructor.name, res.status, item.request.method, request.route)
|
||||
);
|
||||
} else {
|
||||
item.retried = true;
|
||||
item.retries++;
|
||||
this.queue.unshift(item);
|
||||
return this.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user