energizer91 / smart-request-balancer

Smart request queue with fine tuning of rate and limit of requests
MIT License
97 stars 8 forks source link

Ability to clear all the current tasks on queue #13

Closed gustavoFreireS closed 4 years ago

gustavoFreireS commented 4 years ago

there are some cases when the developer wants to clear the request queue for example: if you want to have a polling executing every 5 seconds with low priority but when the condition for this polling to stop is fulfilled you do not want to make the remaining requests stored on the queue

this could be solved adding a public function to clear the array Map, something like:

public clear() {
    debug('Clearing queue', key);
    this.queue.clear();
  }
energizer91 commented 4 years ago

Hi @gustavoFreireS! This sounds like a good api extension. The pull request is on it's way

energizer91 commented 4 years ago

Done. This feature is now in v2.1.0