summary refs log tree commit diff
path: root/api/src
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-04-19 00:57:58 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-04-19 00:57:58 +0200
commit96b3929fa4c0d2cc6613957e6f1636d0f7644527 (patch)
tree17c82d3bfb8d963f9e2ac5cf5540753efdfd714e /api/src
parentgeneral rights enforcement stuff (diff)
downloadserver-96b3929fa4c0d2cc6613957e6f1636d0f7644527.tar.xz
Use 1 thread on platform where fetching thread/core count fails
Diffstat (limited to 'api/src')
-rw-r--r--api/src/start.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/api/src/start.ts b/api/src/start.ts
index 717e1b8f..ccb4d108 100644
--- a/api/src/start.ts
+++ b/api/src/start.ts
@@ -7,7 +7,12 @@ config();
 import { FosscordServer } from "./Server";
 import cluster from "cluster";
 import os from "os";
-const cores = Number(process.env.THREADS) || os.cpus().length;
+var cores = 1;
+try {
+	cores = Number(process.env.THREADS) || os.cpus().length;
+} catch {
+	console.log("[API] Failed to get thread count! Using 1...")
+}
 
 if (cluster.isMaster && process.env.NODE_ENV == "production") {
 	console.log(`Primary ${process.pid} is running`);