In node application which have three different instances running (not using cluster module). I need to implement a scheduler-like-task to run only one of these instances.
-
I though of creating a variable a environment variable which will be passed in one of these instance and other 2 instances will not have this env-variable to the scheduler function will run in this instance.
-
opening a file which will acquire the lock and only those instance will execute the scheduler-like code which have this file lock.
Question: What will be the best approach/design-pattern of solving this problem in nodejs?
Aucun commentaire:
Enregistrer un commentaire