mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
bump fix
This commit is contained in:
parent
503db0970c
commit
434d43875b
@ -53,7 +53,7 @@ module.exports = function(God) {
|
||||
switch (msg.type) {
|
||||
case 'process:exception':
|
||||
God.bus.emit('process:exception', {process : clu, data : msg, err : msg.err});
|
||||
break;
|
||||
break;
|
||||
case 'log:out':
|
||||
God.bus.emit('log:out', {process : clu, data : msg.data});
|
||||
break;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
var axon = require('axon');
|
||||
var os = require('os');
|
||||
var debug = require('debug')('interface:push-interactor');
|
||||
var util = require('util');
|
||||
|
||||
var pkg = require('../../package.json');
|
||||
var cst = require('../../constants.js');
|
||||
@ -23,6 +24,7 @@ var PushInteractor = module.exports = {
|
||||
this.axm_connected = false;
|
||||
this.pm2_connected = false;
|
||||
this.send_buffer = [];
|
||||
this.http_transactions = [];
|
||||
|
||||
/**
|
||||
* Handle PM2 connection state changes
|
||||
@ -30,13 +32,13 @@ var PushInteractor = module.exports = {
|
||||
this.ipm2.on('ready', function() {
|
||||
console.log('[PUSH] Connected to PM2');
|
||||
self.pm2_connected = true;
|
||||
self.getDuplex();
|
||||
self.showDuplex();
|
||||
});
|
||||
|
||||
this.ipm2.on('reconnecting', function() {
|
||||
console.log('[PUSH] Reconnecting to PM2');
|
||||
self.pm2_connected = false;
|
||||
self.getDuplex();
|
||||
self.showDuplex();
|
||||
});
|
||||
|
||||
self.pm2_connected = true;
|
||||
@ -49,16 +51,17 @@ var PushInteractor = module.exports = {
|
||||
this.socket.on('connect', function() {
|
||||
self.axm_connected = true;
|
||||
console.log('[PUSH] Successfully connected to %s:%s', p.host, p.port);
|
||||
self.getDuplex();
|
||||
self.showDuplex();
|
||||
});
|
||||
this.socket.on('error', function(e) {
|
||||
self.axm_connected = false;
|
||||
console.error('[PUSH]', e.stack || e);
|
||||
self.showDuplex();
|
||||
});
|
||||
this.socket.on('reconnect attempt', function() {
|
||||
self.axm_connected = false;
|
||||
console.log('[PUSH] Reconnecting to AXM');
|
||||
self.getDuplex();
|
||||
self.showDuplex();
|
||||
});
|
||||
|
||||
/**
|
||||
@ -67,7 +70,7 @@ var PushInteractor = module.exports = {
|
||||
this.processEvents();
|
||||
this.startWorker();
|
||||
},
|
||||
getDuplex : function() {
|
||||
showDuplex : function() {
|
||||
console.log('PM2', this.pm2_connected, '--->', 'AXM', this.axm_connected);
|
||||
},
|
||||
/**
|
||||
@ -126,6 +129,15 @@ var PushInteractor = module.exports = {
|
||||
self.bufferData('status', ret);
|
||||
}
|
||||
|
||||
if (self.http_transactions && self.http_transactions.length > 0) {
|
||||
self.send_buffer.push({
|
||||
event : 'http:transaction',
|
||||
transactions : self.http_transactions,
|
||||
server_name : self.conf.MACHINE_NAME
|
||||
});
|
||||
self.http_transactions = [];
|
||||
}
|
||||
|
||||
if (cb) return cb();
|
||||
return false;
|
||||
});
|
||||
@ -177,6 +189,13 @@ var PushInteractor = module.exports = {
|
||||
var self = this;
|
||||
|
||||
if (packet.process && !packet.server) {
|
||||
|
||||
if (event == 'http:transaction') {
|
||||
packet.data.data.process_id = self.conf.MACHINE_NAME + ':' + packet.process.name + ':' + packet.process.pm_id;
|
||||
packet.data.data.process_name = packet.process.name;
|
||||
return self.http_transactions.push(packet.data.data);
|
||||
}
|
||||
|
||||
self.send_buffer.push({
|
||||
at : new Date(),
|
||||
event : event,
|
||||
|
||||
@ -24,10 +24,12 @@ var ReverseInteract = module.exports = {
|
||||
|
||||
this.socket.on('error', function(dt) {
|
||||
console.error('[REV] Error', dt);
|
||||
self.socket.destroy();
|
||||
});
|
||||
|
||||
this.socket.on('close', function(dt) {
|
||||
console.log('[REV] Connection closed');
|
||||
self.socket.destroy();
|
||||
|
||||
setTimeout(function() {
|
||||
console.log('[REV] Retrying to connect');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user