From 8baea1a25134b889f07e3934e1017e0fc576dcf4 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 4 Sep 2014 00:01:08 -0400 Subject: [PATCH] crash timer --- loader.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/loader.js b/loader.js index e38a3984c1..d819e0e7bb 100644 --- a/loader.js +++ b/loader.js @@ -11,6 +11,7 @@ var nconf = require('nconf'), * logging * handling SIGHUP * restart signal from child + * minifier */ // pidFilePath = __dirname + '/pidfile', @@ -134,6 +135,12 @@ Loader.init = function() { if (code !== 0) { if (Loader.timesStarted < numCPUs*3) { Loader.timesStarted++; + if (Loader.crashTimer) { + clearTimeout(Loader.crashTimer); + } + Loader.crashTimer = setTimeout(function() { + Loader.timesStarted = 0; + }); } else { console.log(numCPUs*3, 'restarts in 10 seconds, most likely an error on startup. Halting.'); process.exit();