From 2040f90177c1963c4c0b702f6323efab077d53fc Mon Sep 17 00:00:00 2001 From: Mark Stosberg Date: Mon, 12 Jan 2015 12:06:52 -0500 Subject: [PATCH] Fixes #603: Now use a rolling restart to minimize downtime. --- lib/forever.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/forever.js b/lib/forever.js index b0af69b7..21b90205 100644 --- a/lib/forever.js +++ b/lib/forever.js @@ -237,7 +237,13 @@ function stopOrRestart(action, event, format, target) { } if (procs && procs.length > 0) { - async.map(procs, sendAction, function (err, results) { + // If we are restarting, use a rolling-restart so that at least one process is always up, minimizing down time. + var mapAction = async.map; + if (sendAction === 'restart' || sendAction === 'restartall') { + mapAction = async.mapSeries; + } + + mapAction(procs, sendAction, function (err, results) { if (err) { emitter.emit('error', err); }