*/
protected run (task: Task<Data>): void {
const { name, taskId, data } = task
- if (!this.taskFunctions.has(name ?? DEFAULT_TASK_NAME)) {
+ const taskFunctionName = name ?? DEFAULT_TASK_NAME
+ if (!this.taskFunctions.has(taskFunctionName)) {
this.sendToMainWorker({
workerError: {
name: name as string,
})
return
}
- const fn = this.taskFunctions.get(name ?? DEFAULT_TASK_NAME)
+ const fn = this.taskFunctions.get(taskFunctionName)
if (isAsyncFunction(fn)) {
this.runInAsyncScope(this.runAsync.bind(this), this, fn, task)
} else {