X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2Fabstract-worker.ts;h=11a2263a5b5238ac4f728daa8ed97f6ca013c86f;hb=895b5341fc326345504591f709cf2fda7e11257a;hp=107d72384166053e5783f121ef14d0a7abbe69ca;hpb=e81c38f2f8046e9a482e94040b8f6d31dcda160c;p=poolifier.git diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index 107d7238..11a2263a 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -371,8 +371,7 @@ export abstract class AbstractWorker< workerError: { name: taskFunctionName as string, message: this.handleError(response.error as Error | string) - }, - workerId: this.id + } }) } @@ -386,11 +385,11 @@ export abstract class AbstractWorker< if (isAsyncFunction(this.opts.killHandler)) { (this.opts.killHandler?.() as Promise) .then(() => { - this.sendToMainWorker({ kill: 'success', workerId: this.id }) + this.sendToMainWorker({ kill: 'success' }) return null }) .catch(() => { - this.sendToMainWorker({ kill: 'failure', workerId: this.id }) + this.sendToMainWorker({ kill: 'failure' }) }) .finally(() => { this.emitDestroy() @@ -400,9 +399,9 @@ export abstract class AbstractWorker< try { // eslint-disable-next-line @typescript-eslint/no-invalid-void-type this.opts.killHandler?.() as void - this.sendToMainWorker({ kill: 'success', workerId: this.id }) + this.sendToMainWorker({ kill: 'success' }) } catch { - this.sendToMainWorker({ kill: 'failure', workerId: this.id }) + this.sendToMainWorker({ kill: 'failure' }) } finally { this.emitDestroy() } @@ -454,7 +453,7 @@ export abstract class AbstractWorker< performance.now() - this.lastTaskTimestamp > (this.opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME) ) { - this.sendToMainWorker({ kill: this.opts.killBehavior, workerId: this.id }) + this.sendToMainWorker({ kill: this.opts.killBehavior }) } } @@ -485,8 +484,7 @@ export abstract class AbstractWorker< */ protected sendTaskFunctionNamesToMainWorker (): void { this.sendToMainWorker({ - taskFunctionNames: this.listTaskFunctionNames(), - workerId: this.id + taskFunctionNames: this.listTaskFunctionNames() }) } @@ -516,7 +514,6 @@ export abstract class AbstractWorker< message: `Task function '${name as string}' not found`, data }, - workerId: this.id, taskId }) return @@ -546,7 +543,6 @@ export abstract class AbstractWorker< this.sendToMainWorker({ data: res, taskPerformance, - workerId: this.id, taskId }) } catch (error) { @@ -556,7 +552,6 @@ export abstract class AbstractWorker< message: this.handleError(error as Error | string), data }, - workerId: this.id, taskId }) } finally { @@ -582,7 +577,6 @@ export abstract class AbstractWorker< this.sendToMainWorker({ data: res, taskPerformance, - workerId: this.id, taskId }) return null @@ -594,7 +588,6 @@ export abstract class AbstractWorker< message: this.handleError(error as Error | string), data }, - workerId: this.id, taskId }) })