mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
Implement Sequential Rate Limiting
This commit is contained in:
34
src/client/rest/RequestHandlers/RequestHandler.js
Normal file
34
src/client/rest/RequestHandlers/RequestHandler.js
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* A base class for different types of rate limiting handlers for the REST API.
|
||||
* @private
|
||||
*/
|
||||
module.exports = class RequestHandler {
|
||||
constructor(restManager) {
|
||||
/**
|
||||
* The RESTManager that instantiated this RequestHandler
|
||||
* @type {RESTManager}
|
||||
*/
|
||||
this.restManager = restManager;
|
||||
|
||||
/**
|
||||
* A list of requests that have yet to be processed.
|
||||
* @type {Array<APIRequest>}
|
||||
*/
|
||||
this.queue = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a new API request into this bucket
|
||||
* @param {APIRequest} request the new request to push into the queue
|
||||
*/
|
||||
push(request) {
|
||||
this.queue.push(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to get this RequestHandler to process its current queue
|
||||
*/
|
||||
handle() {
|
||||
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user