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] 
> (mailto:[email protected]).
> To post to this group, send email to [email protected] 
> (mailto:[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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to