How to check if queue has room before enqueuing
ronag opened this issue · comments
Currently the only way to know if further tasks can be scheduled is through runTask
and catching an error, which is not optimal.
Is something like this possible to add?
if (!worker.isFull) {
worker.runTask(task)
}
It would be actually really helpful, it should be straightforward.
The following set of lines does verify the queue depth size based on the configuration values and decides whether or not to enqueue/post tasks to any available worker.
Lines 803 to 816 in bcae345
It is a matter of abstracting the maths from these two lines:
Lines 804 to 805 in bcae345
It can also be a refactoring opportunity 🙂
Duplicate of #126