From 64413b016cbe2e2e23d82165f6ff9f71897fa22d Mon Sep 17 00:00:00 2001 From: tknew2 Date: Mon, 29 Sep 2014 19:55:35 +0200 Subject: [PATCH] update unix socket protocol --- examples/keymetrics-load.js | 3 ++- lib/Event.js | 4 ++-- lib/God/ClusterMode.js | 4 ---- lib/God/ForkMode.js | 4 ++-- lib/Interactor/PushInteractor.js | 8 +++----- lib/ProcessContainer.js | 6 +++--- package.json | 6 +++--- 7 files changed, 15 insertions(+), 20 deletions(-) diff --git a/examples/keymetrics-load.js b/examples/keymetrics-load.js index 83bae41a..223b6b08 100644 --- a/examples/keymetrics-load.js +++ b/examples/keymetrics-load.js @@ -9,12 +9,13 @@ pm2.connect(function() { pm2.start('examples/kill-not-so-fast.js', { instances:10, minUptime: 0, + force:true, maxRestarts : 0 }, function() { pm2.start('examples/auto-save.js', {execMode : 'fork', watch:true, force : true}, function() { pm2.start('examples/custom_action_with_params.js', function() { //pm2.start('examples/auto-bench.js', {instances : 'max'}, function() { - pm2.start('examples/throw.js', {name:'auto-throw'}, function() { + pm2.start('examples/throw.js', {force:true, name:'auto-throw'}, function() { pm2.disconnect(function() { process.exit(1); }); }); }); diff --git a/lib/Event.js b/lib/Event.js index 374c10df..71a0f2d8 100644 --- a/lib/Event.js +++ b/lib/Event.js @@ -9,7 +9,7 @@ module.exports = function ForkMode(God) { event : action_name, manually : typeof(manually) == 'undefined' ? false : true, process : Common.formatCLU(data), - at : new Date() + at : Date.now() }); }; @@ -22,7 +22,7 @@ module.exports = function ForkMode(God) { event : opts.action_name, manually : typeof(opts.manually) == 'undefined' ? false : true, process : Common.formatCLU(proc), - at : new Date() + at : Date.now() }); process.nextTick(function() { diff --git a/lib/God/ClusterMode.js b/lib/God/ClusterMode.js index e91ad93a..58756afc 100644 --- a/lib/God/ClusterMode.js +++ b/lib/God/ClusterMode.js @@ -31,10 +31,6 @@ module.exports = function ClusterMode(God) { God.nodeApp = function nodeApp(env_copy, cb){ var clu = null; - // if (fs.existsSync(env_copy.pm_exec_path) == false) { - // return cb(God.logAndGenerateError('Script ' + env_copy.pm_exec_path + ' missing'), {}); - // } - console.log('Starting execution sequence in -cluster mode- for app name:%s id:%s', env_copy.name, env_copy.pm_id); diff --git a/lib/God/ForkMode.js b/lib/God/ForkMode.js index e141e8fa..c9d3b42a 100644 --- a/lib/God/ForkMode.js +++ b/lib/God/ForkMode.js @@ -150,7 +150,7 @@ module.exports = function ForkMode(God) { process : Common.formatCLU(cspr), data : { str : data.toString(), - at : new Date() + at : Date.now() } }); }); @@ -166,7 +166,7 @@ module.exports = function ForkMode(God) { God.bus.emit('log:out', { process : Common.formatCLU(cspr), str : data.toString(), - at : new Date() + at : Date.now() }); }); diff --git a/lib/Interactor/PushInteractor.js b/lib/Interactor/PushInteractor.js index 61f51e47..2396cd7e 100644 --- a/lib/Interactor/PushInteractor.js +++ b/lib/Interactor/PushInteractor.js @@ -49,7 +49,7 @@ var PushInteractor = module.exports = { * Handle PM2 connection state changes */ this.ipm2.on('ready', function() { - console.log('[PUSH] Connected to PM2'); + console.log('[PUSH] Connected to local PM2'); PushInteractor.pm2_connected = true; PushInteractor.startWorker(); }); @@ -155,7 +155,7 @@ var PushInteractor = module.exports = { if (process.env.NODE_ENV && process.env.NODE_ENV == 'test') { data = { public_key : PushInteractor.conf.PUBLIC_KEY, - sent_at : new Date(), + sent_at : Date.now(), data : self._packet }; } @@ -165,14 +165,12 @@ var PushInteractor = module.exports = { * Cipher data with AES256 */ - //console.log(self._packet); - var cipheredData = Cipher.cipherMessage(JSON.stringify(self._packet), PushInteractor.conf.SECRET_KEY); data = { public_key : self.conf.PUBLIC_KEY, - sent_at : new Date(), + sent_at : Date.now(), data : cipheredData }; } diff --git a/lib/ProcessContainer.js b/lib/ProcessContainer.js index a9f1fc2b..56bb9047 100644 --- a/lib/ProcessContainer.js +++ b/lib/ProcessContainer.js @@ -121,7 +121,7 @@ function exec(script, outFile, errFile) { type : 'log:err', data : { str : string, - at : new Date() + at : Date.now() } }); }; @@ -138,7 +138,7 @@ function exec(script, outFile, errFile) { type : 'log:out', data : { str : string, - at : new Date() + at : Date.now() } }); }; @@ -168,7 +168,7 @@ function exec(script, outFile, errFile) { errObj[key] = err[key]; }); - errObj.at = new Date(); + errObj.at = Date.now(); process.send({ type : 'process:exception', diff --git a/package.json b/package.json index 46abf473..fb3fb4e4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pm2", "preferGlobal": "true", - "version": "0.11.0-beta1", + "version": "0.11.0-beta2", "os": [ "!win32" ], @@ -133,8 +133,8 @@ "nssocket" : "0.5.1", "pidusage" : "0.1.0", - "axm" : "0.2.0", - "pm2-axon" : "2.0.3", + "axm" : "0.2.4", + "pm2-axon" : "2.0.4", "pm2-axon-rpc" : "0.3.3", "pm2-deploy" : "~0.1.0", "pm2-interface" : "2.0.1",