Skip to content

threadFork

threadFork(options?): (script, env) => ChildProcess

Defined in: packages/sharding/src/thread.ts:78

Runs each cluster as a worker thread of the manager’s process instead of a forked process: pass it as ClusterManager’s fork. Threads start faster and use less memory; a crash that takes the process down (an out-of-memory abort, a native fault) takes every cluster with it. The worker script is the same: ShardManager, ShardBus and ClusterWorker find the parent through parentPort.

ThreadForkOptions = {}

(script, env) => ChildProcess