jeudi 25 août 2016

instance specific code to run in nodejs

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.

  1. 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.

  2. 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