I first invoked PM2 with pm2 start index.js --watch --ignore-watch "node_modules"
. However, despite telling it to watch my files for changes and then reload, it is not using the latest version of my app when I pull from git.
To test this:
$ git show
new version commit message
$ pm2 describe index | grep comment
old version commit message
So PM2 is using a cached version.
I tried to reload the app manually, using pm2 reload index
:
$ pm2 reload index
[PM2] Applying action reloadProcessId on app [index](ids: 0)
[PM2] [index](0) ✓
However, it's still not using the latest version of my app. pm2 describe index | grep comment
shows exactly the same old version commit message.
The only way I am able to get it to work is running pm2 kill
and then pm2 resurrect
, but that's not a satisfactory solution. It's too slow!
Is PM2 doing some caching? I've read through all of their docs and done an extensive search but can't figure this out.