caddyjas.blogg.se

Nodejs sleep await
Nodejs sleep await







nodejs sleep await

There are some promise that can resolve the node core isn't aware of (in my case as far I can remember it has something to do console input, or it was some other library which control IO was a promise. This has all little to do with the issue at hand. The 'beforeExit' should not be used as an alternative to the 'exit' event unless the intention is to schedule additional work.

nodejs sleep await

The 'beforeExit' event is not emitted for conditions causing explicit termination, such as calling process.exit() or uncaught exceptions.The listener callback function is invoked with the value of process.exitCode passed as the only argument.Normally, the Node.js process will exit when there is no work scheduled, but a listener registered on the 'beforeExit' event can make asynchronous calls, and thereby cause the Node.js process to continue. The 'beforeExit' event is emitted when Node.js empties its event loop and has no additional work to schedule.There is the 'beforeExit' event described in node docsĪnd called with process.on('beforeExit'.). It is frustrated to debug without an message printed to console, telling the programmer that the progress is exited without an ever-pending Promise being resolved.Ī warning message printed to the console would have saved my day.









Nodejs sleep await