My understanding is that NodeJS runs until all the events are drained from the event queue, and then it will exit. On various occasions I have written a script, that uses third party modules and it does what I want it to do, but doesn't exit. I assume that's because some of the other third party modules have something in the event queue.
Is there anything I can do to watch the queue, encourage it to be drained, or even determine who still has something to do (and perhaps get enough information to know that if I process.exit anyway, no harm will be done)
Thanks for your suggestions.