}
const timestamp = performance.now()
const workerNodeKey = this.chooseWorkerNode()
- const workerInfo = this.getWorkerInfo(workerNodeKey)
const task: Task<Data> = {
name: name ?? DEFAULT_TASK_NAME,
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
data: data ?? ({} as Data),
transferList,
timestamp,
- workerId: workerInfo.id as number,
+ workerId: this.getWorkerInfo(workerNodeKey).id as number,
taskId: randomUUID()
}
this.promiseResponseMap.set(task.taskId as string, {
this.emitter?.emit(PoolEvents.error, error)
if (
this.opts.restartWorkerOnError === true &&
- !this.starting &&
- this.started
+ this.started &&
+ !this.starting
) {
if (workerInfo.dynamic) {
this.createAndSetupDynamicWorkerNode()