There's no lag nor delay nor CPU usage. I just get a message such as:
[INFO] 10:08:17 Restarting: /Users/derya/cvr/cvr-reports/app/routes/main.ts has been modified
And nothing else. It never actually restarts or rebuilds the project. How do I debug this?
I tried with the --debug flag:
[INFO] 15:15:29 Restarting: /Users/derya/cvr/cvr-reports/app/routes/main.ts has been modified
[DEBUG] 15:15:29 /Users/derya/cvr/cvr-reports/app/routes/main.ts compiled in 219 ms
[DEBUG] 15:15:29 Removing all watchers from files
[DEBUG] 15:15:29 Child is still running, restart upon exit
[DEBUG] 15:15:29 Disconnecting from child
[DEBUG] 15:15:29 Sending SIGTERM kill to child pid 91901
Looks like maybe the child process won't quit? This is ts-node-dev 1.0.0-pre.38 and typescript 3.4.5
edit: I suppose I should add that I am running ts-node-dev via
ts-node-dev --respawn --debug --ignore-watch node_modules -- ./app/app.ts
See docs:
In some rare cases ts-node-dev may fail to terminate an application by sending SIGTERM signal, this may be caused by the app having running heavy child process or something. But the app should get the signal anyway and it can be explicitly processed there: process.on('SIGTERM', () => process.exit()).
Try maybe it would work for your case.
Yep that worked, thanks!
Oh maybe I should add though, I don't think that the app is running heavy child processes. It's an express app, so it's listening on some port, but I've had bigger express apps continue to refresh with ts-node-dev just fine. Back when I was debugging this, I tried turning off a few different parts of it, and couldn't figure out what the culprit was between my 1 express app that respected the SIGTERM and my new app that didn't.
I too don't know exactly what may cause it, I actually met with some apps that spawned other processes like (chrome headless, etc). Anyway, I always process SIGTERM in apps because kubernetes cluster sends the signal before it is going to shut down the container, so the app may stop its work gracefully, and in dev mode, I just do process.exit().
The hangs on restarting can also happen because of a bad exception handling : https://github.com/whitecolor/ts-node-dev/issues/120
Most helpful comment
See docs:
Try maybe it would work for your case.