Implement Sequential Rate Limiting

This commit is contained in:
Amish Shah
2016-08-19 18:01:24 +01:00
parent 392133f927
commit dcba580d89
9 changed files with 122 additions and 84 deletions

View 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() {
}
};