Skip to content

Commit

Permalink
Implemented: Observe process_list and dump every time something changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jshkurti committed Dec 19, 2014
1 parent 8d828a8 commit 806039b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/God.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var cst = require('../constants.js');
var pidusage = require('pidusage');
var vizion = require('vizion');
var debug = require('debug')('pm2:god');
var observe = require('observe-js');

// Memory leak inspector
// require('webkit-devtools-agent').start({
Expand Down Expand Up @@ -40,6 +41,16 @@ var God = module.exports = {
})
};

var obs = new observe.ObjectObserver(God.clusters_db);
obs.open(function() {
God.dumpProcessList && God.dumpProcessList(function() {
console.log('Process List Dumped');
});
});
if (!Object.observe) {
setInterval(Platform.performMicrotaskCheckpoint, 1000);
}

/**
* Hack Global Console Of PM2
*/
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"soyuka <soyuka@gmail.com>",
"Alex Kocharin <alex@kocharin.ru>",
"achingbrain <alex@achingbrain.net>",
"Joni Shkurti <jshkurti@student.42.fr>",
"Joni Shkurti <jonishkurti90@gmail.com>",
"Jun Tjatse <thisnamemeansnothing@gmail.com>"
],
"contributors": [
Expand Down Expand Up @@ -140,6 +140,7 @@

"axm" : "~0.2.*",
"vizion" : "latest",
"observe-js" : "^0.4.2",

"pm2-axon" : "2.0.7",
"pm2-axon-rpc" : "0.3.6",
Expand Down

0 comments on commit 806039b

Please sign in to comment.