[Feature] emit `drained` event when Queue is empty
Created by: marshall007
Currently, there does not appear to be a reliable way to be notified when the queue is done processing all active jobs and there are no other remaining jobs in the queue. It would be nice if a drained
event were emitted in this case indicating that there is no remaining work to be done.
Use case is for knowing when it's safe to close/empty/clean up a Queue without missing any jobs.
The only workaround I'm aware of is to manually check the result of getJobCounts()
after every completed
event.