Skip to content

Commit

Permalink
update to 0.8.7, add command line kill remain server log
Browse files Browse the repository at this point in the history
Change-Id: I1147b0964e4d71533480bbbbc9ffa0af32ea5883
  • Loading branch information
xiecc committed Jan 28, 2014
1 parent d21d044 commit 1e0af82
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.8.7 / 2013-01-28
=================
* refactor pomelo command, report remained servers if kill failed

0.8.6 / 2013-01-22
=================
* upgrade pomelo-rpc 0.2.9
Expand Down
16 changes: 9 additions & 7 deletions lib/modules/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var Module = function(opts) {
};

Module.prototype.monitorHandler = function(agent, msg, cb) {
var serverId = agent.id;
switch(msg.signal) {
case 'stop':
if(agent.type === 'master') {
Expand All @@ -39,7 +40,6 @@ Module.prototype.monitorHandler = function(agent, msg, cb) {
this.app.stop(true);
break;
case 'list':
var serverId = agent.id;
var serverType = agent.type;
var pid = process.pid;
var heapUsed = (process.memoryUsage().heapUsed/(1024 * 1024)).toFixed(2);
Expand All @@ -52,7 +52,6 @@ Module.prototype.monitorHandler = function(agent, msg, cb) {
});
break;
case 'kill':
var serverId = agent.id;
utils.invokeCallback(cb, serverId);
if (agent.type !== 'master') {
setTimeout(function() {
Expand Down Expand Up @@ -114,18 +113,21 @@ var kill = function(app, agent, msg, cb) {
}, MONITOR_KILL_DELAY);
});

for(sid in agent.idMap) {
record = agent.idMap[sid];
serverIds.push(record.id);
agent.request(record.id, module.exports.moduleId, { signal: msg.signal }, function(msg) {
var agentRequestCallback = function(msg) {
for (var i = 0; i < serverIds.length; ++i) {
if (serverIds[i] === msg) {
serverIds.splice(i,1);
latch.done();
break;
}
}
});
};


for(sid in agent.idMap) {
record = agent.idMap[sid];
serverIds.push(record.id);
agent.request(record.id, module.exports.moduleId, { signal: msg.signal }, agentRequestCallback);
}
};

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pomelo",
"version": "0.8.6",
"version": "0.8.7",
"private": false,
"homepage": "https://github.com/NetEase/pomelo",
"repository": {
Expand Down Expand Up @@ -39,7 +39,7 @@
"pomelo-logger": "0.1.2",
"pomelo-scheduler": "0.3.8",
"ws": "0.4.25",
"toobusy": "0.2.2",
"toobusy": "0.2.4",
"pomelo-protobuf": "0.4.0",
"node-bignumber": "1.2.1",
"commander": "2.0.0"
Expand Down

0 comments on commit 1e0af82

Please sign in to comment.