mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
Cleanup Part 2: Electric Boogaloo (Reloaded) (#594)
* Cleanup Part 2: Electric Boogaloo (Reloaded) * Moar cleanup * Tweak NOT_A_PERMISSION error
This commit is contained in:
committed by
Amish Shah
parent
5a9c42061f
commit
0b908f5bce
@@ -8,7 +8,10 @@ const RequestHandler = require('./RequestHandler');
|
||||
* @private
|
||||
*/
|
||||
class SequentialRequestHandler extends RequestHandler {
|
||||
|
||||
/**
|
||||
* @param {RESTManager} restManager The REST manager to use
|
||||
* @param {string} endpoint The endpoint to handle
|
||||
*/
|
||||
constructor(restManager, endpoint) {
|
||||
super(restManager, endpoint);
|
||||
|
||||
@@ -39,8 +42,8 @@ class SequentialRequestHandler extends RequestHandler {
|
||||
|
||||
/**
|
||||
* Performs a request then resolves a promise to indicate its readiness for a new request
|
||||
* @param {APIRequest} item the item to execute
|
||||
* @returns {Promise<Object, Error>}
|
||||
* @param {APIRequest} item The item to execute
|
||||
* @returns {Promise<?Object|Error>}
|
||||
*/
|
||||
execute(item) {
|
||||
return new Promise(resolve => {
|
||||
@@ -88,9 +91,8 @@ class SequentialRequestHandler extends RequestHandler {
|
||||
|
||||
handle() {
|
||||
super.handle();
|
||||
if (this.waiting || this.queue.length === 0 || this.globalLimit) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.waiting || this.queue.length === 0 || this.globalLimit) return;
|
||||
this.waiting = true;
|
||||
|
||||
const item = this.queue[0];
|
||||
|
||||
Reference in New Issue
Block a user