crash timer

v1.18.x
Julian Lam 11 years ago
parent c8692f0562
commit 8baea1a251

@ -11,6 +11,7 @@ var nconf = require('nconf'),
* logging * logging
* handling SIGHUP * handling SIGHUP
* restart signal from child * restart signal from child
* minifier
*/ */
// pidFilePath = __dirname + '/pidfile', // pidFilePath = __dirname + '/pidfile',
@ -134,6 +135,12 @@ Loader.init = function() {
if (code !== 0) { if (code !== 0) {
if (Loader.timesStarted < numCPUs*3) { if (Loader.timesStarted < numCPUs*3) {
Loader.timesStarted++; Loader.timesStarted++;
if (Loader.crashTimer) {
clearTimeout(Loader.crashTimer);
}
Loader.crashTimer = setTimeout(function() {
Loader.timesStarted = 0;
});
} else { } else {
console.log(numCPUs*3, 'restarts in 10 seconds, most likely an error on startup. Halting.'); console.log(numCPUs*3, 'restarts in 10 seconds, most likely an error on startup. Halting.');
process.exit(); process.exit();

Loading…
Cancel
Save