modules/orionode/lib/graceful-cluster/graceful-cluster.js
function checkRestartQueue() {
            // Kill one worker only if maximum count are working.
            if (restartQueue.length > 0 && listeningWorkersCount === workersCount && !currentRestartingPid) {
                var pid = restartQueue.shift();
                try {
                    // Store process id to wait for its finish.
                    currentRestartingPid = pid;
                    // Send SIGTERM signal to worker. SIGTERM starts graceful shutdown of worker inside it.
                    process.kill(pid);

                } catch(ex) {

                    // Reset current pid.
                    currentRestartingPid = null;

                    // If no process killed, try next in queue.
                    process.nextTick(checkRestartQueue);

                    // Fail silent on 'No such process'. May occur when kill message received after kill initiated but not finished.
                    if (ex.code !== 'ESRCH') {
                        throw ex;
                    }
                }
            }
        }
function checkRestartQueue() {
            // Kill one worker only if maximum count are working.
            if (restartQueue.length > 0 && listeningWorkersCount === workersCount && !currentRestartingPid) {
                var pid = restartQueue.shift();
                try {
                    // Store process id to wait for its finish.
                    currentRestartingPid = pid;
                    // Send SIGTERM signal to worker. SIGTERM starts graceful shutdown of worker inside it.
                    process.kill(pid);

                } catch(ex) {

                    // Reset current pid.
                    currentRestartingPid = null;

                    // If no process killed, try next in queue.
                    process.nextTick(checkRestartQueue);

                    // Fail silent on 'No such process'. May occur when kill message received after kill initiated but not finished.
                    if (ex.code !== 'ESRCH') {
                        throw ex;
                    }
                }
            }
        }
function checkRestartQueue ( ) { // Kill one worker only if maximum count are working. if ( restartQueue . length > 0 && listeningWorkersCount === workersCount && ! currentRestartingPid ) { var pid = restartQueue . shift ( ) ; try { // Store process id to wait for its finish. currentRestartingPid = pid ; // Send SIGTERM signal to worker. SIGTERM starts graceful shutdown of worker inside it. process . kill ( pid ) ; } catch ( ex ) { // Reset current pid. currentRestartingPid = null ; // If no process killed, try next in queue. process . nextTick ( checkRestartQueue ) ; // Fail silent on 'No such process'. May occur when kill message received after kill initiated but not finished. if ( ex . code !== 'ESRCH' ) { throw ex ; } } } }
Prevent killing all workers at same time when restarting.
Prevent killing all workers at same time when restarting .