Cluster - Worker exit #49

Closed
opened 2020-05-28 09:54:23 +00:00 by Ghost · 2 comments

If a worker exit, will greenlock-express create a new one?

If a worker exit, will greenlock-express create a new one?
Author

Found it:

Master._spawnWorker = function(opts, greenlock) {
    var w = cluster.fork();
    // automatically added to master's `cluster.workers`
    w.once("exit", function(code, signal) {
        // TODO handle failures
        // Should test if the first starts successfully
        // Should exit if failures happen too quickly

        // For now just kill all when any die
        if (signal) {
            console.error("worker was killed by signal:", signal);
        } else if (code !== 0) {
            console.error("worker exited with error code:", code);
        } else {
            console.error("worker unexpectedly quit without exit code or signal");
        }
        process.exit(2);

        //addWorker();
    });

and

cluster.once("exit", function() {
        setTimeout(function() {
            process.exit(3);
        }, 100);
    });

You should fork a new worker:

Cluster.fork()

I am using good old greenlock-cluster and want to switch to greenlock-express or greenlock (Is there cluster support?).

Found it: ``` Master._spawnWorker = function(opts, greenlock) { var w = cluster.fork(); // automatically added to master's `cluster.workers` w.once("exit", function(code, signal) { // TODO handle failures // Should test if the first starts successfully // Should exit if failures happen too quickly // For now just kill all when any die if (signal) { console.error("worker was killed by signal:", signal); } else if (code !== 0) { console.error("worker exited with error code:", code); } else { console.error("worker unexpectedly quit without exit code or signal"); } process.exit(2); //addWorker(); }); ``` and ``` cluster.once("exit", function() { setTimeout(function() { process.exit(3); }, 100); }); ``` You should fork a new worker: `Cluster.fork()` I am using good old greenlock-cluster and want to switch to greenlock-express or greenlock (Is there cluster support?).
Owner

You should supply { cluster: true } (same as number of CPU cores) or { cluster: 4 } (exactly 4).

Workers should not exit.

If a worker exits, it's considered to be a fatal error and the whole program will exit (and your system launcher will cause it to immediately restart).

You should supply `{ cluster: true }` (same as number of CPU cores) or `{ cluster: 4 }` (exactly 4). Workers should not exit. If a worker exits, it's considered to be a fatal error and the whole program will exit (and your system launcher will cause it to immediately restart).
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: root/greenlock-express.js#49
No description provided.