mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 15:13:05 +00:00
Use 1 thread on platform where fetching thread/core count fails
This commit is contained in:
1 parent
c3f69bc6d8
commit
1cc159348a
3 files changed
+18
-3
No files matched your search
+6
-1
@@ -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`);
|
||||
|
||||
Reference in new issue
Block a user