summary refs log tree commit diff
path: root/bundle
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-04-19 20:09:22 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-04-19 20:09:22 +1000
commitb941560d484024d764521ab9ca42f4bb900b00be (patch)
treef130ec9ef94665f4e38056eb958a1b0709438efc /bundle
parentfixed migration? (diff)
parentTry catch cpu log (diff)
downloadserver-b941560d484024d764521ab9ca42f4bb900b00be.tar.xz
Merge branch 'master' into slowcord
Diffstat (limited to 'bundle')
-rw-r--r--bundle/package-lock.json10
-rw-r--r--bundle/scripts/benchmark/connections.js7
-rw-r--r--bundle/src/start.ts7
-rw-r--r--bundle/src/stats.ts8
4 files changed, 25 insertions, 7 deletions
diff --git a/bundle/package-lock.json b/bundle/package-lock.json
index 8c99fce6..8e620582 100644
--- a/bundle/package-lock.json
+++ b/bundle/package-lock.json
@@ -7350,8 +7350,9 @@
 			}
 		},
 		"node_modules/minimist": {
-			"version": "1.2.5",
-			"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
+			"version": "1.2.6",
+			"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
+			"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
 		},
 		"node_modules/minipass": {
 			"version": "3.1.5",
@@ -16582,8 +16583,9 @@
 			}
 		},
 		"minimist": {
-			"version": "1.2.5",
-			"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
+			"version": "1.2.6",
+			"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
+			"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
 		},
 		"minipass": {
 			"version": "3.1.5",
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");
diff --git a/bundle/src/start.ts b/bundle/src/start.ts
index 7660b296..de3b5848 100644
--- a/bundle/src/start.ts
+++ b/bundle/src/start.ts
@@ -9,7 +9,12 @@ config();
 import { execSync } from "child_process";
 
 // TODO: add socket event transmission
-let 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) {
 	function getCommitOrFail() {
diff --git a/bundle/src/stats.ts b/bundle/src/stats.ts
index 3c5163c3..0234e0b4 100644
--- a/bundle/src/stats.ts
+++ b/bundle/src/stats.ts
@@ -4,7 +4,13 @@ import { red } from "picocolors";
 
 export function initStats() {
 	console.log(`[Path] running in ${__dirname}`);
-	console.log(`[CPU] ${osu.cpu.model()} Cores x${osu.cpu.count()}`);
+	try {
+		console.log(`[CPU] ${osu.cpu.model()} Cores x${osu.cpu.count()}`);
+	}
+	catch {
+		console.log('[CPU] Failed to get cpu model!')
+	}
+	
 	console.log(`[System] ${os.platform()} ${os.arch()}`);
 	console.log(`[Process] running with PID: ${process.pid}`);
 	if (process.getuid && process.getuid() === 0) {