const executeTaskFunction = data => {
switch (data.function) {
- case TaskFunctions.jsonIntegerSerialization:
- return jsonIntegerSerialization(data.taskSize || 1000)
- case TaskFunctions.fibonacci:
- return fibonacci(data.taskSize || 1000)
case TaskFunctions.factorial:
return factorial(data.taskSize || 1000)
+ case TaskFunctions.fibonacci:
+ return fibonacci(data.taskSize || 1000)
+ case TaskFunctions.jsonIntegerSerialization:
+ return jsonIntegerSerialization(data.taskSize || 1000)
case TaskFunctions.readWriteFiles:
return readWriteFiles(data.taskSize || 1000)
default:
this.closeMessageChannel()
this.removeAllListeners()
switch (this.info.type) {
- case WorkerTypes.thread:
- this.worker.unref?.()
- await this.worker.terminate?.()
- break
case WorkerTypes.cluster:
this.registerOnceWorkerEventHandler('disconnect', () => {
this.worker.kill?.()
})
this.worker.disconnect?.()
break
+ case WorkerTypes.thread:
+ this.worker.unref?.()
+ await this.worker.terminate?.()
+ break
}
await waitWorkerExit
}