There are N Workers and one Master. 
Workers are unstable and frequently can hang up or die. 
If worker dies - it's ok because there will be error in callback in master. 
But if worker hangs - there's a problem - callback in master also will 
hangs indefinitely.

And this is a problem, I need to kill those hanging callbacks in master.

Is it possible to do something like this?

    function safeCallToSomeRemoteService(callback){
      var remoteServiceResponded = false      
      unsafeCallToSomeRemoteService(function(err, data){
        remoteServiceResponded = true
        callback(err, data)
      })
      
      setTimeout(function(){
        if(!remoteServiceResponded){
          somehow kill callback waiting for remote service
          callback(new Error("Remote service hanged!"))
        }
      }, 3000)
    }

Or, if it's not possible, is it safe to just ignore such hanged callbacks, 
call callback on timeout and move on (while leaving hanging callback 
active)?


-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
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 nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to