fix: process awake from sleeping

This commit is contained in:
Tjatse 2014-12-17 11:24:45 +08:00
parent f3db779eb9
commit 2bac20f2e4
2 changed files with 13 additions and 3 deletions

View File

@ -358,6 +358,7 @@ Monitor.prototype._startWatching = function(){
this._throttleRefresh();
}.bind(this));
// Enforce a refresh operation if RPC is not online.
this._throttleRefresh();
};

View File

@ -26,9 +26,18 @@ pm.sub = function(sockPath, cb){
var sub = axon.socket('sub-emitter'),
sub_sock = sub.connect(sockPath);
sub.on('process:*', function(event, data){
if (data && !!~allowedEvents.indexOf(data.event)) {
cb(data);
// Once awake from sleeping.
sub.on('log:*', function(e, d){
// Do not subscribe it.
sub.off('log:*');
d.event = 'awake';
cb(d);
});
// Process events.
sub.on('process:*', function(e, d){
if (d && !!~allowedEvents.indexOf(d.event)) {
cb(d);
}
});
};