Might be nice to have abortable tasks. Another queue library allows you to return an abject with an abort function like this...
function delayedHello(callback) {
var id = setTimeout(function() {
console.log("Hello")
callback(null);
}, delay)
return {
abort: function() {
clearTimeout(id)
}
}
}
I guess another option could be to just queue.once('end',...) from within your task if any cleanups need to be done. Although it's ambiguous when the end event occurs whether you've aborted or the queue has finished all tasks. Perhaps a special event for when a queue is ended manually? Should end() be renamed to abort()? Sorry for my stream of consciousness. Any thoughts @jessetane?
Might be nice to have abortable tasks. Another queue library allows you to return an abject with an abort function like this...
I guess another option could be to just
queue.once('end',...)
from within your task if any cleanups need to be done. Although it's ambiguous when the end event occurs whether you've aborted or the queue has finished all tasks. Perhaps a special event for when a queue is ended manually? Shouldend()
be renamed toabort()
? Sorry for my stream of consciousness. Any thoughts @jessetane?