index.js
function createWorkerExitHandler(port) {
        return function (code, signal) {
            var workerIndex = port - startPort;

            workers[workerIndex] = null;

            if (code !== 0 || code === null) {
                console.log('Worker exited with code: ' + code);

                if (!shuttingDown) {
                    // Start worker again after 1 sec
                    setTimeout(function () {
                        if (!workers[workerIndex]) {
                            workers[workerIndex] = startWorker(port);
                        }
                    }, 1000);
                }
            }
        };
    }
function createWorkerExitHandler(port) {
        return function (code, signal) {
            var workerIndex = port - startPort;

            workers[workerIndex] = null;

            if (code !== 0 || code === null) {
                console.log('Worker exited with code: ' + code);

                if (!shuttingDown) {
                    // Start worker again after 1 sec
                    setTimeout(function () {
                        if (!workers[workerIndex]) {
                            workers[workerIndex] = startWorker(port);
                        }
                    }, 1000);
                }
            }
        };
    }
function createWorkerExitHandler ( port ) { return function ( code , signal ) { var workerIndex = port - startPort ; workers [ workerIndex ] = null ; if ( code !== 0 || code === null ) { console . log ( 'Worker exited with code: ' + code ) ; if ( ! shuttingDown ) { // Start worker again after 1 sec setTimeout ( function ( ) { if ( ! workers [ workerIndex ] ) { workers [ workerIndex ] = startWorker ( port ) ; } } , 1000 ) ; } } } ; }
Create a listener function to handle a premature exit event from a worker
@private
@param {Number} port The port number of the worker.
@returns {Function}
Create a listener function to handle a premature exit event from a worker