Answer the question
In order to leave comments, you need to log in
How to make a common timer for all Node.js processes?
I use pm2 for daemonization and clustering.
I run pm2 start app.js -i 8
8 copies of the process on 8 cores.
There was a need to use a common timer loop for all processes.
Is it even possible to do this with pm2? How to enter into the database?
Or redo the entire architecture through Cluster?
Answer the question
In order to leave comments, you need to log in
pm2.keymetrics.io/docs/usage/pm2-api/#send-message...
Or a simpler and more convenient option:
https://github.com/pm2-hive/pm2-intercom
One timer process makes publish in redis
The rest, by subscribe, catch this notification and do their own logic
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question