From eccc0164ebec630ab71e3379bede276b0265446a Mon Sep 17 00:00:00 2001 From: tknew2 Date: Tue, 30 Sep 2014 15:38:25 +0200 Subject: [PATCH 1/3] patch interactor --- constants.js | 6 ++++-- lib/Interactor/InteractorDaemonizer.js | 13 +++++++------ lib/Satan.js | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/constants.js b/constants.js index 0d72ce7e..96e9f467 100644 --- a/constants.js +++ b/constants.js @@ -28,9 +28,11 @@ var default_conf = { DAEMON_RPC_PORT : parseInt(process.env.PM2_RPC_PORT) || 6666, // RPC commands DAEMON_PUB_PORT : parseInt(process.env.PM2_PUB_PORT) || 6667, // Realtime events + INTERACTOR_RPC_PORT : parseInt(process.env.PM2_INTERACTOR_PORT) || 6668, DAEMON_RPC_PORT : p.join(DEFAULT_FILE_PATH, 'rpc.sock'), DAEMON_PUB_PORT : p.join(DEFAULT_FILE_PATH, 'pub.sock'), + INTERACTOR_RPC_PORT : p.join(DEFAULT_FILE_PATH, 'interactor.sock'), CODE_UNCAUGHTEXCEPTION : 100, @@ -69,9 +71,9 @@ var default_conf = { SEND_INTERVAL : 1000, INTERACTOR_LOG_FILE_PATH : p.join(DEFAULT_FILE_PATH, 'agent.log'), - INTERACTOR_PID_PATH : p.join(DEFAULT_FILE_PATH, 'agent.pid'), + INTERACTOR_PID_PATH : p.join(DEFAULT_FILE_PATH, 'agent.pid') + - INTERACTOR_RPC_PORT : parseInt(process.env.PM2_INTERACTOR_PORT) || 6668 }; module.exports = default_conf; diff --git a/lib/Interactor/InteractorDaemonizer.js b/lib/Interactor/InteractorDaemonizer.js index 67ae9727..f9e9f0f7 100644 --- a/lib/Interactor/InteractorDaemonizer.js +++ b/lib/Interactor/InteractorDaemonizer.js @@ -26,22 +26,23 @@ InteractorDaemonizer.ping = function(cb) { var client = new rpc.Client(req); debug('[PING INTERACTOR] Trying to connect to Interactor daemon'); + client.sock.once('reconnect attempt', function() { client.sock.close(); debug('Interactor Daemon not launched'); process.nextTick(function() { return cb(false); - }) + }); }); client.sock.once('connect', function() { client.sock.on('close', function() { - debug('Ping socket closed'); return cb(true); }); client.sock.close(); debug('Interactor Daemon alive'); }); + req.connect(cst.INTERACTOR_RPC_PORT); }; @@ -74,11 +75,9 @@ InteractorDaemonizer.killDaemon = function(cb) { * @return */ InteractorDaemonizer.launchRPC = function(cb) { - var req = axon.socket('req'); + var self = this; + var req = axon.socket('req'); this.client = new rpc.Client(req); - var self = this; - - this.client_sock = req.connect(cst.INTERACTOR_RPC_PORT); debug('Generating methods'); @@ -123,6 +122,8 @@ InteractorDaemonizer.launchRPC = function(cb) { cb(); }); }); + + this.client_sock = req.connect(cst.INTERACTOR_RPC_PORT); }; /** diff --git a/lib/Satan.js b/lib/Satan.js index 6c3a430b..effaefdb 100644 --- a/lib/Satan.js +++ b/lib/Satan.js @@ -325,7 +325,7 @@ Satan.pingDaemon = function pingDaemon(cb) { debug('Daemon not launched'); process.nextTick(function() { return cb(false); - }) + }); }); client.sock.once('connect', function() { @@ -348,7 +348,7 @@ Satan.pingDaemon = function pingDaemon(cb) { */ Satan.launchRPC = function launchRPC(cb) { debug('Launching RPC client on port %s %s', cst.DAEMON_RPC_PORT, cst.DAEMON_BIND_HOST); - var req = axon.socket('req'); + var req = axon.socket('req'); Satan.client = new rpc.Client(req); Satan.client.sock.once('connect', function() { From cd14ad6d4c9325a9599eb8207ac314c7f37550da Mon Sep 17 00:00:00 2001 From: tknew2 Date: Tue, 30 Sep 2014 16:54:29 +0200 Subject: [PATCH 2/3] travis 0.11.14 --- .travis.yml | 2 +- lib/God/ActionMethods.js | 2 -- test/fixtures/killthen.js | 5 ----- 3 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 test/fixtures/killthen.js diff --git a/.travis.yml b/.travis.yml index fe623105..f801372a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ branches: only: - master - development - - communication-protocol node_js: + - "0.11.14" - "0.11.13" - "0.10.31" - "0.10.30" diff --git a/lib/God/ActionMethods.js b/lib/God/ActionMethods.js index 31a055c9..e5a6eaf4 100644 --- a/lib/God/ActionMethods.js +++ b/lib/God/ActionMethods.js @@ -124,8 +124,6 @@ module.exports = function(God) { if (!(id in God.clusters_db)) return cb(God.logAndGenerateError(id + ' id unknown'), {}); - //God.notify('started', God.clusters_db[id], true); - if (God.clusters_db[id].pm2_env.status == cst.ONLINE_STATUS) return cb(God.logAndGenerateError('process already online'), {}); return God.executeApp(God.clusters_db[id].pm2_env, cb); diff --git a/test/fixtures/killthen.js b/test/fixtures/killthen.js deleted file mode 100644 index 2f296237..00000000 --- a/test/fixtures/killthen.js +++ /dev/null @@ -1,5 +0,0 @@ - -setInterval(function() { - console.log('BOUM'); - process.exit(1); -}, 30); From db7ba762052f61ef032cea893d5cb001cf5075d4 Mon Sep 17 00:00:00 2001 From: tknew2 Date: Tue, 30 Sep 2014 16:57:13 +0200 Subject: [PATCH 3/3] travis 0.10 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index f801372a..08dc2ffd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ branches: node_js: - "0.11.14" - "0.11.13" + - "0.10" - "0.10.31" - "0.10.30" - "0.10.29"