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); }