feature: allow sweeping of inactive request buckets

This commit is contained in:
Amish Shah
2018-05-02 17:57:48 +01:00
parent 745669a7c9
commit b5f37728a7
5 changed files with 35 additions and 13 deletions

View File

@@ -26,6 +26,13 @@ class RequestHandler {
this.handle();
}
get _inactive() {
return this.queue.length === 0 &&
!this.limited &&
Date.now() > this.resetTime &&
(typeof this.busy === 'undefined' || this.busy === false);
}
execute(item) {
return new Promise((resolve, reject) => {
const finish = timeout => {