diff --git a/README.md b/README.md index 851cfb3a..48054b19 100644 --- a/README.md +++ b/README.md @@ -292,9 +292,10 @@ nodemon sends a kill signal to your application when it sees a file update. If y The following example will listen once for the `SIGUSR2` signal (used by nodemon to restart), run the clean up process and then kill itself for nodemon to continue control: ```js -process.once('SIGUSR2', function () { +// important to use `on` and not `once` as nodemon can re-send the kill signal +process.on('SIGUSR2', function () { gracefulShutdown(function () { - process.kill(process.pid, 'SIGUSR2'); + process.kill(process.pid, 'SIGTERM'); }); }); ``` diff --git a/faq.md b/faq.md index 6209ccc7..f0425825 100644 --- a/faq.md +++ b/faq.md @@ -353,8 +353,10 @@ Your application will likely be running the old version code if you see that mes A common cause for this is when graceful shutdowns are doing async tasks, i.e: ``` -process.once('SIGUSR2', async () => { +// ensure this is `on` and not `once` +process.on('SIGUSR2', async () => { await db.disconnect() + process.kill(process.pid, 'SIGTERM'); }) ```