Permalink
Browse files

better check for lost peers

  • Loading branch information...
evantahler committed Apr 12, 2012
1 parent 988ca80 commit f6affc6049a8d047b419566b5da1ef53b3b813c5
Showing with 8 additions and 2 deletions.
  1. +8 −2 initializers/initTasks.js
View
@@ -99,8 +99,14 @@ var initTasks = function(api, next)
var checkForTaskComplete = function(api, requestID, taskName, peer){
api.actionCluster.cache.checkForComplete(api, requestID, 1, function(resp){
if(resp == false || resp.length == 0){
- api.tasks.processing[peer] = false;
- api.tasks.enqueue(api, taskName, params);
+ // peer still there?
+ if(api.actionCluster.peers[peer] == "connected"){
+ api.log("waiting for "+respPeer +"to comple task...", "yellow");
+ checkForTaskComplete(api, requestID, taskName, peer);
+ }else{
+ api.tasks.processing[peer] = false;
+ api.tasks.enqueue(api, taskName, params);
+ }
}else{
var content = resp.taskResp;
var respPeer = resp[0].remotePeer.host + ":" + resp[0].remotePeer.port;

0 comments on commit f6affc6

Please sign in to comment.