Thursday 4 May 2017

In Pm2 cluster mode the global variable has different value for each thread

I have a NodeJs application which is running in cluster mode with 4 instance. A map is defined in a file "pipeline.js" like below :

var map = new Map();
module.exports = map;

I entered value in map like below :

map[value] = value_1;

In the code I have to remove the value from map but it gives error saying :

map[value] is empty.

But when rum with only 1 instance this error doesn't appear.

Thanks in advance !



via Pranav Anand

No comments:

Post a Comment