How do I force PM2 to use the latest version of my app?
Asked Answered
M

1

3

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.

Medicable answered 13/4, 2020 at 14:43 Comment(0)
M
1

After further testing this appears to be a bug in PM2's reporting of the git commit. The version being served is actually the latest version, but PM2 is reporting the out-of-date one. Bug report published.

Medicable answered 14/4, 2020 at 14:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.