feat: allow to disable tasks timeout check in worker
[poolifier.git] / src / worker / abstract-worker.ts
index 8a38b4e576464ecb88078540cc8604d7b3ad323f..2afd6f3486a1103347a258c575cece7773e3c4d3 100644 (file)
@@ -71,7 +71,10 @@ export abstract class AbstractWorker<
     super(type)
     this.checkWorkerOptions(this.opts)
     this.checkTaskFunctions(taskFunctions)
-    if (!this.isMain) {
+    if (
+      !this.isMain &&
+      (this.opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME) > 0
+    ) {
       this.lastTaskTimestamp = performance.now()
       this.aliveInterval = setInterval(
         this.checkAlive.bind(this),