Yes, that works pretty well actually, I've used it a lot to synchronize a small in-memory cache to each process and distribute jobs to workers.
2014-12-09 7:33 GMT-08:00 Ω Alisson <[email protected]>: > if I do something like this on a worker process, wouldn't be effective? > > process.on("message", function(m) { > if(m.cmd === "disconnect") { > // cleanup logic > } > }) > > On Tue, Dec 9, 2014 at 5:20 AM, Issac Roth <[email protected]> wrote: > >> There are many ways to do this but we created strong-mq >> <https://www.npmjs.org/package/strong-mq> with this kind of use case in >> mind. What’s nice is you can use a common message-passing pattern between >> workers that runs natively over node-cluster without installing anything >> else, and if you end up scaling across servers you can not change your code >> but go to a different messaging backend. >> >> Another way would be to implement a simple semaphore kind of setup using >> strong-store-cluster <https://www.npmjs.org/package/strong-store-cluster>. >> Or do the same in Redis. >> >> Issac >> >> Create APIs in Node in minutes: LoopBack >> <http://strongloop.com/strongloop-suite/loopback/> >> >> On Monday, December 8, 2014 at 3:47 PM, Ω Alisson wrote: >> >> I'm running a Node app that fetches Redis data into another database. >> It´s using the cluster module, everything works fine but I need to ensure >> that workers will finish properly their jobs(they use BRPOP then allocate >> into a object then insert in batches cleaning the objects), how do I do >> this? >> >> -- >> Job board: http://jobs.nodejs.org/ >> New group rules: >> https://gist.github.com/othiym23/9886289#file-moderation-policy-md >> Old group rules: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> --- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/nodejs/CACZE8Y5XARF0mzr7H30jVqoS33Kf7KzR_yFE4FOuh%2Bybj%3DJuSw%40mail.gmail.com >> <https://groups.google.com/d/msgid/nodejs/CACZE8Y5XARF0mzr7H30jVqoS33Kf7KzR_yFE4FOuh%2Bybj%3DJuSw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> Job board: http://jobs.nodejs.org/ >> New group rules: >> https://gist.github.com/othiym23/9886289#file-moderation-policy-md >> Old group rules: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> --- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/nodejs/3845DF3360164E9992FAD400F3E7B9D5%40strongloop.com >> <https://groups.google.com/d/msgid/nodejs/3845DF3360164E9992FAD400F3E7B9D5%40strongloop.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > Job board: http://jobs.nodejs.org/ > New group rules: > https://gist.github.com/othiym23/9886289#file-moderation-policy-md > Old group rules: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/nodejs/CACZE8Y4o77eNEJHfsvkDGYMp1b7O_Vidz50s-nDSwDfBx%3DL5Lg%40mail.gmail.com > <https://groups.google.com/d/msgid/nodejs/CACZE8Y4o77eNEJHfsvkDGYMp1b7O_Vidz50s-nDSwDfBx%3DL5Lg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- John R. Fitzgerald -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAAsAE96zjUBqEyG9M3%2B6X7XzBq%2Bq9d5PpUsmzqexifer%3DnaC-g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
