[autofix.ci] apply automated fixes
authorautofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Thu, 17 Oct 2024 14:09:14 +0000 (14:09 +0000)
committerGitHub <noreply@github.com>
Thu, 17 Oct 2024 14:09:14 +0000 (14:09 +0000)
benchmarks/benchmarks-utils.cjs
src/pools/worker-node.ts

index 30eb1e2b9215cb48435161d9f94dd3a49746121f..2f401e8055f6bbc212a355f9f0a0b6f700a05a93 100644 (file)
@@ -76,12 +76,12 @@ const readWriteFiles = (
 
 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:
index 1a1f207b67634d48a71f613a143b9567ded4239c..73160a25b179dec8127f0e089635b2bf2005c6ca 100644 (file)
@@ -298,16 +298,16 @@ export class WorkerNode<Worker extends IWorker, Data = unknown>
     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
   }