mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 01:01:30 +00:00
fix sequential and burst ratelimiters from going on timeout because the queue is empty (#1722)
* create branch for me to work on * fix sequential and burst ratelimiters from going on timeout because the queue is empty
This commit is contained in:
parent
8bd7b82110
commit
080996b5a9
3 changed files with 3 additions and 3 deletions
|
|
@ -14,7 +14,7 @@ class RequestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
get limited() {
|
get limited() {
|
||||||
return this.queue.length === 0 || this.manager.globallyRateLimited || this.remaining <= 0;
|
return this.manager.globallyRateLimited || this.remaining <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set globallyLimited(limited) {
|
set globallyLimited(limited) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
module.exports = function burst() {
|
module.exports = function burst() {
|
||||||
if (this.limited) return;
|
if (this.limited || this.queue.length === 0) return;
|
||||||
this.execute(this.queue.shift())
|
this.execute(this.queue.shift())
|
||||||
.then(this.handle.bind(this))
|
.then(this.handle.bind(this))
|
||||||
.catch(({ timeout }) => {
|
.catch(({ timeout }) => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
module.exports = function sequential() {
|
module.exports = function sequential() {
|
||||||
if (this.busy || this.limited) return;
|
if (this.busy || this.limited || this.queue.length === 0) return;
|
||||||
this.busy = true;
|
this.busy = true;
|
||||||
this.execute(this.queue.shift())
|
this.execute(this.queue.shift())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue