From 0fd8f549e2194223eca2d4b17f4e96cd5a0f5fd5 Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Wed, 13 Mar 2024 22:52:25 +0530 Subject: fix(ext/node): allow automatic worker_thread termination (#22647) Co-authored-by: Matt Mastracci --- ext/node/polyfills/worker_threads.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext/node/polyfills') diff --git a/ext/node/polyfills/worker_threads.ts b/ext/node/polyfills/worker_threads.ts index 15b51aeb4..4563f157f 100644 --- a/ext/node/polyfills/worker_threads.ts +++ b/ext/node/polyfills/worker_threads.ts @@ -211,6 +211,7 @@ class NodeWorker extends EventEmitter { permissions: null, name: this.#name, workerType: "module", + closeOnIdle: true, }, serializedWorkerMetadata, ); @@ -413,7 +414,7 @@ internals.__initWorkerThreads = ( >(); parentPort = self as ParentPort; - if (typeof maybeWorkerMetadata !== "undefined") { + if (maybeWorkerMetadata) { const { 0: metadata, 1: _ } = maybeWorkerMetadata; workerData = metadata.workerData; environmentData = metadata.environmentData; -- cgit v1.2.3