repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(deps-dev): bump @typescript-eslint/eslint-plugin
[poolifier.git]
/
src
/
worker
/
thread-worker.ts
diff --git
a/src/worker/thread-worker.ts
b/src/worker/thread-worker.ts
index 6f36664b8ae1a56cebb5058d7d4c56885b5ae88f..d5ce3a2f130da3efbe81f0aa0e3b3e7394033822 100644
(file)
--- a/
src/worker/thread-worker.ts
+++ b/
src/worker/thread-worker.ts
@@
-42,7
+42,7
@@
export class ThreadWorker<
opts: WorkerOptions = {}
) {
super(
opts: WorkerOptions = {}
) {
super(
- '
worker-thread-pool:poolifi
er',
+ '
poolifier:thread-work
er',
isMainThread,
parentPort as MessagePort,
taskFunctions,
isMainThread,
parentPort as MessagePort,
taskFunctions,
@@
-60,10
+60,15
@@
export class ThreadWorker<
try {
this.port = message.port
this.port.on('message', this.messageListener.bind(this))
try {
this.port = message.port
this.port.on('message', this.messageListener.bind(this))
- this.sendTaskFunctionsListToMainWorker()
- this.sendToMainWorker({ ready: true, workerId: this.id })
+ this.sendToMainWorker({
+ ready: true,
+ taskFunctionNames: this.listTaskFunctionNames()
+ })
} catch {
} catch {
- this.sendToMainWorker({ ready: false, workerId: this.id })
+ this.sendToMainWorker({
+ ready: false,
+ taskFunctionNames: this.listTaskFunctionNames()
+ })
}
}
}
}
}
}
@@
-82,11
+87,14
@@
export class ThreadWorker<
/** @inheritDoc */
protected sendToMainWorker (message: MessageValue<Response>): void {
/** @inheritDoc */
protected sendToMainWorker (message: MessageValue<Response>): void {
- this.port.postMessage(
message
)
+ this.port.postMessage(
{ ...message, workerId: this.id }
)
}
}
- /** @inheritDoc */
- protected handleError (e: Error | string): string {
- return e as string
+ /**
+ * @inheritDoc
+ * @override
+ */
+ protected handleError (error: Error | string): string {
+ return error as string
}
}
}
}