super(
'worker-cluster-pool:poolifier',
cluster.isPrimary,
- taskFunctions,
cluster.worker as Worker,
+ taskFunctions,
opts
)
}
+ /** @inheritDoc */
+ protected handleReadyMessage (message: MessageValue<Data>): void {
+ if (!this.isMain && message.workerId === this.id && message.ready != null) {
+ this.getMainWorker()?.on('message', this.messageListener.bind(this))
+ this.sendToMainWorker({ ready: true, workerId: this.id })
+ }
+ }
+
/** @inheritDoc */
protected get id (): number {
return this.getMainWorker().id
protected sendToMainWorker (message: MessageValue<Response>): void {
this.getMainWorker().send(message)
}
-
- /** @inheritDoc */
- protected handleError (e: Error | string): string {
- return e instanceof Error ? e.message : e
- }
}