Skip to content

Commit

Permalink
Merge pull request #1 from Unitech/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Tjatse committed Dec 4, 2014
2 parents bf2bf8a + 643d775 commit 174ca28
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ $ pm2 save

We're going to release a very nice product, a dashboard to monitor every part of your Node.js applications. Here are some links:

- [Register to Keymetrics I/O](https://keymetrics.io/)
- [Pitch + Survey](https://docs.google.com/forms/d/1FuCjIhrGg-ItxInq2nLreoe9GS-gZWJNkNWE0JJajw8/viewform) People who fill the survey will be eligible for free license

Thanks in advance and we hope that you like PM2!

Expand Down
2 changes: 1 addition & 1 deletion examples/axm/keymetrics-load.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


var pm2 = require('..');
var pm2 = require('../..');

pm2.connect(function() {
pm2.delete('all', function() {
Expand Down
12 changes: 6 additions & 6 deletions examples/axm/keymetrics-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ pm2.connect(function() {
pm2.delete('all', function() {
pm2.start('examples/axm/pm2_probe.js', function() {
pm2.start('examples/axm/pm2_agent_probe.js', function() {
pm2.start('examples/axm/event.js', function() {
pm2.start('examples/axm/http_app.js', {instances:4},function() {
pm2.start('examples/axm/event.js', {force:true}, function() {
pm2.start('examples/axm/http_app.js', {force:true, instances:4},function() {
pm2.start('examples/axm/probes.js',function() {
pm2.start('examples/axm/custom_action.js', function() {
pm2.start('examples/axm/custom_action_with_params.js', {name : 'custom'} , function() {
pm2.start('examples/axm/http_transaction.js', {name:'trace'}, function() {
pm2.start('examples/axm/throw.js', {name:'auto-throw', execMode : 'cluster_mode'}, function() {
pm2.start('examples/axm/custom_action.js', {force:true}, function() {
pm2.start('examples/axm/custom_action_with_params.js', {force:true, name : 'custom'} , function() {
pm2.start('examples/axm/http_transaction.js', {name:'trace', force:true}, function() {
pm2.start('examples/axm/throw.js', {name:'auto-throw', execMode : 'cluster_mode', force:true}, function() {
pm2.disconnect(function() { process.exit(1); });
});
});
Expand Down
8 changes: 7 additions & 1 deletion lib/CLI.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,13 @@ CLI._operate = function(action_name, process_name, envs, cb) {
return next(new Error('Process not found'));
}

Satan.notifyGod('restart', id);
if (action_name == 'restartProcessId') {
Satan.notifyGod('restart', id);
} else if (action_name == 'deleteProcessId') {
Satan.notifyGod('delete', id);
} else if (action_name == 'stopProcessId') {
Satan.notifyGod('stop', id);
}

printOut(cst.PREFIX_MSG + action_name + ' process id %d', id);
return next();
Expand Down
7 changes: 3 additions & 4 deletions lib/God/ClusterMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ var cluster = require('cluster');
var fs = require('fs');
var cst = require('../../constants.js');
var util = require('util');
var Common = require('../Common');

var Utility = require('../Utility.js');
var pkg = require('../../package.json');

/**
Expand Down Expand Up @@ -62,9 +61,9 @@ module.exports = function ClusterMode(God) {
*********************************/
if (msg.data && msg.type) {
return God.bus.emit(msg.type ? msg.type : 'process:msg', {
at : Math.round(Date.now() / 1000),
at : Utility.getDate(),
data : msg.data,
process : Common.formatCLU(clu)
process : Utility.formatCLU(clu)
});
}
else {
Expand Down
12 changes: 11 additions & 1 deletion lib/Utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ var async = require('async');

var Utility = module.exports = {
getDate : function() {
return Math.round(Date.now() / 1000);
return Date.now();
},
formatCLU : function(process) {
if (!process.pm2_env) {
return process;
}

var obj = Utility.serialize(process.pm2_env);
delete obj.env;

return obj;
},
serialize : function(data) {
return JSON.parse(Stringify(data));
Expand Down

0 comments on commit 174ca28

Please sign in to comment.