* @param opts - Options for the worker.
*/
public constructor (
- type: string,
protected readonly isMain: boolean,
private readonly mainWorker: MainWorker,
taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>,
protected opts: WorkerOptions = DEFAULT_WORKER_OPTIONS
) {
- // super(type)
if (this.isMain == null) {
throw new Error('isMain parameter is mandatory')
}
taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>,
opts: WorkerOptions = {}
) {
- super(
- 'poolifier:cluster-worker',
- cluster.isPrimary,
- cluster.worker as Worker,
- taskFunctions,
- opts
- )
+ super(cluster.isPrimary, cluster.worker as Worker, taskFunctions, opts)
}
/** @inheritDoc */
taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>,
opts: WorkerOptions = {}
) {
- super(
- 'poolifier:thread-worker',
- isMainThread,
- parentPort as MessagePort,
- taskFunctions,
- opts
- )
+ super(isMainThread, parentPort as MessagePort, taskFunctions)
}
/** @inheritDoc */