From 38cf8bb68dec64a2609d6a9147f5ccf49d7abbd2 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Fri, 18 Oct 2024 21:01:51 +0200 Subject: [PATCH] fix: fix the cluster limit of one process for Deno with shimmed clustering module --- src/index.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index b501a6a..0f1d155 100644 --- a/src/index.js +++ b/src/index.js @@ -1436,16 +1436,26 @@ function SVRJSFork() { ((process.isBun && process.versions.bun && process.versions.bun[0] != "0") || - (process.versions && process.versions.deno_)) && + (process.versions && process.versions.deno)) && Object.keys(cluster.workers) > 0 ) ) { newWorker = cluster.fork(); } else { - if (SVRJSInitialized) - serverconsole.locwarnmessage( - `${name} limited the number of workers to one, because of startup problems in Bun 1.0 and newer with shimmed (not native) clustering module. Reliability may suffer.` - ); + if (SVRJSInitialized) { + if ( + process.isBun && + process.versions.bun && + process.versions.bun[0] != "0" + ) + serverconsole.locwarnmessage( + `${name} limited the number of workers to one, because of startup problems in Bun 1.0 and newer with shimmed (not native) clustering module. Reliability may suffer.` + ); + else if (process.versions && process.versions.deno) + serverconsole.locwarnmessage( + `${name} limited the number of workers to one, because of startup problems in Deno with shimmed (not native) clustering module. Reliability may suffer.` + ); + } } } catch (err) { if (