1.2.7 • Published 6 years ago

fork-named-cluster v1.2.7

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

fork-named-cluster

you can fork your cluster with custom process name as filename.

when you has multi-cluster, It will be make you debug easier.

usage

/// your-worker-file
setTimeout(()=>{
    process.emit("MY_CUSTOM_READY_EVENT", {say:"hi"})
});
import { forkCluster, forkChildProcess } from 'fork-named-cluster';
// or
const { forkCluster, forkChildProcess } = require('fork-named-cluster');


forkCluster(require.resolve('./your-worker-file'), {
    process_name:"custom-process-name"
});

const { wait_ready } = forkChildProcess(require.resolve('./your-worker-file'), {
    ready_event: "MY_CUSTOM_READY_EVENT",
    process_name:"custom-process-name"
});
const ready_data = await wait_ready;// {say:"hi"}

and you can get your process name by:

process[Symbol.for('name')]
process.name
process.env.name

DEMO

it is my demo code:

image

and run it as --inspect-brk, then open your chrome://inspect.

you can see:

image

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago