X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2Fcluster-worker.ts;h=eedf13bd9265cb30b6d7cd689c42e2c517367acd;hb=380fd983fd66032e433c2b41127663ed3f8dd14a;hp=d972692ec6eb4f182479cac008c47a1f20b75d8d;hpb=b73887071ac359b50a7f117a76b3edf268841aac;p=poolifier.git diff --git a/src/worker/cluster-worker.ts b/src/worker/cluster-worker.ts index d972692e..eedf13bd 100644 --- a/src/worker/cluster-worker.ts +++ b/src/worker/cluster-worker.ts @@ -1,8 +1,8 @@ import cluster, { type Worker } from 'node:cluster' -import type { MessageValue } from '../utility-types' -import { AbstractWorker } from './abstract-worker' -import type { WorkerOptions } from './worker-options' -import type { TaskFunction, TaskFunctions } from './task-functions' +import type { MessageValue } from '../utility-types.js' +import { AbstractWorker } from './abstract-worker.js' +import type { WorkerOptions } from './worker-options.js' +import type { TaskFunction, TaskFunctions } from './task-functions.js' /** * A cluster worker used by a poolifier `ClusterPool`. @@ -32,7 +32,7 @@ export class ClusterWorker< taskFunctions: TaskFunction | TaskFunctions, opts: WorkerOptions = {} ) { - super(cluster.isPrimary, cluster.worker as Worker, taskFunctions, opts) + super(cluster.isPrimary, cluster.worker, taskFunctions, opts) } /** @inheritDoc */ @@ -62,6 +62,9 @@ export class ClusterWorker< protected readonly sendToMainWorker = ( message: MessageValue ): void => { - this.getMainWorker().send({ ...message, workerId: this.id }) + this.getMainWorker().send({ + ...message, + workerId: this.id + } satisfies MessageValue) } }