mirror of
https://github.com/danbulant/discord.js
synced 2026-07-08 12:40:50 +00:00
fix websocket ratelimits (#2014)
This commit is contained in:
parent
69dcfa0708
commit
d8f6198a12
1 changed files with 4 additions and 3 deletions
|
|
@ -62,8 +62,9 @@ class WebSocketConnection extends EventEmitter {
|
||||||
*/
|
*/
|
||||||
this.ratelimit = {
|
this.ratelimit = {
|
||||||
queue: [],
|
queue: [],
|
||||||
remaining: 60,
|
remaining: 120,
|
||||||
total: 60,
|
total: 120,
|
||||||
|
time: 60e3,
|
||||||
resetTimer: null,
|
resetTimer: null,
|
||||||
};
|
};
|
||||||
this.connect(gateway);
|
this.connect(gateway);
|
||||||
|
|
@ -152,7 +153,7 @@ class WebSocketConnection extends EventEmitter {
|
||||||
this.ratelimit.resetTimer = this.client.setTimeout(() => {
|
this.ratelimit.resetTimer = this.client.setTimeout(() => {
|
||||||
this.ratelimit.remaining = this.ratelimit.total;
|
this.ratelimit.remaining = this.ratelimit.total;
|
||||||
this.processQueue();
|
this.processQueue();
|
||||||
}, 120e3);
|
}, this.ratelimit.time);
|
||||||
}
|
}
|
||||||
while (this.ratelimit.remaining > 0) {
|
while (this.ratelimit.remaining > 0) {
|
||||||
const item = this.ratelimit.queue.shift();
|
const item = this.ratelimit.queue.shift();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue