From 4fb08b655cf12d7470bc1b64befeda215a6c036b Mon Sep 17 00:00:00 2001 From: jshkurti Date: Fri, 5 Jun 2015 15:22:55 +0200 Subject: [PATCH] GC is now called first when the worker runs to reduce ENOMEM errors --- lib/Worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Worker.js b/lib/Worker.js index bd2665f0..09aca67c 100644 --- a/lib/Worker.js +++ b/lib/Worker.js @@ -107,6 +107,8 @@ module.exports = function(God) { } God.Worker.is_running = true; + God.forceGc(); + God.getMonitorData(null, function(err, data) { if (err || !data || typeof(data) !== 'object') { God.Worker.is_running = false; @@ -131,8 +133,6 @@ module.exports = function(God) { debug('[PM2][WORKER] My job here is done, next job in %d seconds', parseInt(cst.WORKER_INTERVAL / 1000)); }); }); - - God.forceGc(); }; God.Worker.start = function() {