naught
naught copied to clipboard
How can I distinguish between worker processes?
Hello. I would like to distinguish between the worker processes and run some code only in one process. Normally with node clusters you can do this by checking the cluster.isMaster property, but that does not work with naught because naught is the master.
Is there another way to distinguish and run some code only on 1 process per server while running under naught?
Thanks! Otherwise very pleased with naught.
Hello, The node cluster (same with naught) provides an environment variable to identify the current worker :
process.env['WORKER_ID']
my2cents
In my version (which may be older), it's process.env['NAUGHT_WORKER'].