mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
feat(Rest): better handling of global rate limit and invalid request tracking (#4711)
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: Tristan Guichaoua <33934311+tguichaoua@users.noreply.github.com> Co-authored-by: Papaia <43409674+Papaia@users.noreply.github.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
@@ -13,7 +13,10 @@ class RESTManager {
|
||||
this.handlers = new Collection();
|
||||
this.tokenPrefix = tokenPrefix;
|
||||
this.versioned = true;
|
||||
this.globalTimeout = null;
|
||||
this.globalLimit = client.options.restGlobalRateLimit > 0 ? client.options.restGlobalRateLimit : Infinity;
|
||||
this.globalRemaining = this.globalLimit;
|
||||
this.globalReset = null;
|
||||
this.globalDelay = null;
|
||||
if (client.options.restSweepInterval > 0) {
|
||||
client.setInterval(() => {
|
||||
this.handlers.sweep(handler => handler._inactive);
|
||||
|
||||
Reference in New Issue
Block a user