From 96b3929fa4c0d2cc6613957e6f1636d0f7644527 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Tue, 19 Apr 2022 00:57:58 +0200 Subject: Use 1 thread on platform where fetching thread/core count fails --- bundle/scripts/benchmark/connections.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bundle/scripts/benchmark/connections.js') diff --git a/bundle/scripts/benchmark/connections.js b/bundle/scripts/benchmark/connections.js index 2a4125b4..ffca2628 100644 --- a/bundle/scripts/benchmark/connections.js +++ b/bundle/scripts/benchmark/connections.js @@ -3,8 +3,13 @@ const cluster = require("cluster"); const WebSocket = require("ws"); const endpoint = process.env.GATEWAY || "ws://localhost:3001"; const connections = Number(process.env.CONNECTIONS) || 50; -const threads = Number(process.env.THREADS) || require("os").cpus().length || 1; const token = process.env.TOKEN; +var cores = 1; +try { + cores = Number(process.env.THREADS) || os.cpus().length; +} catch { + console.log("[Bundle] Failed to get thread count! Using 1...") +} if (!token) { console.error("TOKEN env var missing"); -- cgit 1.5.1