Closed RageYL closed 2 years ago
I guess it's because there is nothing on the event loop anymore: https://stackoverflow.com/questions/46914025/node-exits-without-error-and-doesnt-await-promise-event-callback
Sounds like it's not a bug =)
Actually, would it be possible to have a check in drain() to return immediately if the queue is empty? This should prevent this problem.
This is behaving as expected. When q.drain()
is called without any arguments, it returns a promise that resolves when the queue drains. Since the queue is never started, it never drains, so the promise is never resolved and console.log('after');
is not called.
I don't think it makes sense to return immediately if the queue is empty as the queue could be loaded asynchronously.
Version 3.2.3 NodeJS, Typescript 4.6.4
See 'before' and 'after' being printed'. Instead I got:
The process exit without any error after the call to drain. I was able to reproduce on a linux laptop and a macos laptop.