cwait icon indicating copy to clipboard operation
cwait copied to clipboard

Change concurrency level after initialization

Open slumbi opened this issue 7 years ago • 1 comments

Currently it is possible to decrease the concurrency of the queue, and it behaves as expected. Increasing it however does not work, because each time a task finishes , only one new task gets executed instead of one task per available slot ( concurrency-busyCount )

This feature would allow to dynamically change processing speed, and even pause the jobs for a period of time.

slumbi avatar May 17 '18 12:05 slumbi

I guess TaskQueue should have a setConcurrency method that also calls next when increasing it, to immediately start new eligible tasks before previous ones finish.

Then next could have a loop like:

while(this.busyCount < this.concurrency) { ... }

jjrv avatar May 17 '18 13:05 jjrv