sequential-task-queue
sequential-task-queue copied to clipboard
Max Size
Hi.
Would be great to have the posibility to set a maxsize for the queue
Any idea of what should happen when maxSize
is exceeded? I think push
should throw an Error
in this case, because the error
event is used to notify of errors thrown in a running task. Another option is to return a Promise
that is immediately rejected, and report the rejection in an error
event.
hm.. I think that it can simply throw an exception. Because it's not an async check but you know if the size is in overflow immedialty at push time. One can manage the event with a try/catch around the push. You can mimci this extension https://github.com/cnwhy/promise-queue-plus I's a good extension but I have prefered your for lighter dedendencies.
I don't think Promise Queue Plus supports this at all. It has an option to set the maximum concurrent tasks, but as far as I can tell from the source, it doesn't have an option to limit queue length.
you are right... my mistake. The max queue size is implemented in this lib https://github.com/azproduction/promise-queue