cluster-status
Advanced tools
Comparing version 0.5.0-SNAPSHOT.1387314512824 to 0.5.0-SNAPSHOT.1387826685226
29
index.js
@@ -53,2 +53,4 @@ 'use strict'; | ||
} | ||
emitter.to([pid]).emit('status-registered', name); | ||
}); | ||
@@ -67,2 +69,4 @@ | ||
logger().info('[status] unregister status: %s in process: %d', name, pid); | ||
emitter.to([pid]).emit('status-unregistered', name); | ||
}); | ||
@@ -92,2 +96,12 @@ | ||
var tillRegistered = when.defer(); | ||
emitter.on('status-registered', function onRegistered(registered){ | ||
if(name === registered){ | ||
tillRegistered.resolve(registered); | ||
emitter.removeListener('status-registered', onRegistered); | ||
} | ||
}); | ||
emitter.to(['master', 'self']).emit('new-status', name, process.pid, view, update); | ||
@@ -106,2 +120,4 @@ | ||
}); | ||
return tillRegistered.promise; | ||
}, | ||
@@ -111,2 +127,13 @@ | ||
var tillUnregistered = when.defer(); | ||
emitter.on('status-unregistered', function onUnregistered(unregistered){ | ||
if(name === unregistered){ | ||
tillUnregistered.resolve(unregistered); | ||
emitter.removeListener('status-unregistered', onUnregistered); | ||
} | ||
}); | ||
emitter.to(['master', 'self']).emit('del-status', name, process.pid); | ||
@@ -117,2 +144,4 @@ | ||
emitter.removeAllListeners(util.format('set-status-%s', name)); | ||
return tillUnregistered.promise; | ||
}, | ||
@@ -119,0 +148,0 @@ |
{ | ||
"name": "cluster-status", | ||
"version": "0.5.0-SNAPSHOT.1387314512824", | ||
"version": "0.5.0-SNAPSHOT.1387826685226", | ||
"description": "cluster-status ===============", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -35,35 +35,38 @@ 'use strict'; | ||
return view; | ||
}); | ||
}) | ||
.then(function(registered){ | ||
status.getStatus(name).then(function(result){ | ||
name.should.equal(registered); | ||
status.getStatus(name).then(function(result){ | ||
result.should.be.ok; | ||
result.length.should.equal(1); | ||
result.should.be.ok; | ||
result.length.should.equal(1); | ||
var stat = result.shift(); | ||
stat.should.be.ok; | ||
stat.pid.should.equal(process.pid); | ||
stat.name.should.equal(name); | ||
stat.status.should.equal(view); | ||
var stat = result.shift(); | ||
stat.should.be.ok; | ||
stat.pid.should.equal(process.pid); | ||
stat.name.should.equal(name); | ||
stat.status.should.equal(view); | ||
status.setStatus(name, 'noop').then(function(){ //as we didn't register update, setStatus should have no effect at all. | ||
status.setStatus(name, 'noop').then(function(){ //as we didn't register update, setStatus should have no effect at all. | ||
status.getStatus(name).then(function(result){ | ||
status.getStatus(name).then(function(result){ | ||
result.should.be.ok; | ||
result.length.should.equal(1); | ||
result.should.be.ok; | ||
result.length.should.equal(1); | ||
var stat = result.shift(); | ||
stat.should.be.ok; | ||
stat.pid.should.equal(process.pid); | ||
stat.name.should.equal(name); | ||
stat.status.should.equal(view); | ||
var stat = result.shift(); | ||
stat.should.be.ok; | ||
stat.pid.should.equal(process.pid); | ||
stat.name.should.equal(name); | ||
stat.status.should.equal(view); | ||
done(); | ||
done(); | ||
}); | ||
}); | ||
}, done); | ||
}, done); | ||
}, done); | ||
}); | ||
}); | ||
@@ -70,0 +73,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13046
316