mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
lots of important stuff (#1883)
* lots of important stuff * Update Constants.js
This commit is contained in:
16
src/rest/handlers/sequential.js
Normal file
16
src/rest/handlers/sequential.js
Normal file
@@ -0,0 +1,16 @@
|
||||
module.exports = function sequential() {
|
||||
if (this.busy || this.limited || this.queue.length === 0) return;
|
||||
this.busy = true;
|
||||
this.execute(this.queue.shift())
|
||||
.then(() => {
|
||||
this.busy = false;
|
||||
this.handle();
|
||||
})
|
||||
.catch(({ timeout }) => {
|
||||
this.client.setTimeout(() => {
|
||||
this.reset();
|
||||
this.busy = false;
|
||||
this.handle();
|
||||
}, timeout || (this.resetTime - Date.now() + this.timeDifference + this.client.options.restTimeOffset));
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user