summary refs log tree commit diff
path: root/src/bundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/bundle')
-rw-r--r--src/bundle/Server.ts2
-rw-r--r--src/bundle/start.ts21
2 files changed, 12 insertions, 11 deletions
diff --git a/src/bundle/Server.ts b/src/bundle/Server.ts
index a5f96c3a..96f6a149 100644
--- a/src/bundle/Server.ts
+++ b/src/bundle/Server.ts
@@ -24,7 +24,7 @@ import * as Api from "@fosscord/api";
 import * as Gateway from "@fosscord/gateway";
 import { CDNServer } from "@fosscord/cdn";
 import express from "express";
-import { green, bold, yellow } from "picocolors";
+import { green, bold } from "picocolors";
 import { Config, initDatabase, Sentry } from "@fosscord/util";
 
 const app = express();
diff --git a/src/bundle/start.ts b/src/bundle/start.ts
index 10fb7c36..8da3cc20 100644
--- a/src/bundle/start.ts
+++ b/src/bundle/start.ts
@@ -29,14 +29,15 @@ import { execSync } from "child_process";
 
 const cores = process.env.THREADS ? parseInt(process.env.THREADS) : 1;
 
-if (cluster.isPrimary) {
-	function getCommitOrFail() {
-		try {
-			return execSync("git rev-parse HEAD").toString().trim();
-		} catch (e) {
-			return null;
-		}
+function getCommitOrFail() {
+	try {
+		return execSync("git rev-parse HEAD").toString().trim();
+	} catch (e) {
+		return null;
 	}
+}
+
+if (cluster.isPrimary) {
 	const commit = getCommitOrFail();
 
 	console.log(
@@ -81,14 +82,14 @@ Cores: ${cyan(os.cpus().length)} (Using ${cores} thread(s).)
 		// Fork workers.
 		for (let i = 0; i < cores; i++) {
 			// Delay each worker start if using sqlite database to prevent locking it
-			let delay = process.env.DATABASE?.includes("://") ? 0 : i * 1000;
+			const delay = process.env.DATABASE?.includes("://") ? 0 : i * 1000;
 			setTimeout(() => {
 				cluster.fork();
 				console.log(`[Process] worker ${cyan(i)} started.`);
 			}, delay);
 		}
 
-		cluster.on("message", (sender: Worker, message: any) => {
+		cluster.on("message", (sender: Worker, message) => {
 			for (const id in cluster.workers) {
 				const worker = cluster.workers[id];
 				if (worker === sender || !worker) continue;
@@ -96,7 +97,7 @@ Cores: ${cyan(os.cpus().length)} (Using ${cores} thread(s).)
 			}
 		});
 
-		cluster.on("exit", (worker: any, code: any, signal: any) => {
+		cluster.on("exit", (worker) => {
 			console.log(
 				`[Worker] ${red(
 					`died with PID: ${worker.process.pid} , restarting ...`,