mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-29 01:09:20 +00:00
Commit evil (set process names)
This commit is contained in:
@@ -26,6 +26,7 @@ config({ quiet: true });
|
||||
import { SpacebarServer } from "./Server";
|
||||
import cluster from "cluster";
|
||||
import os from "os";
|
||||
import fs from "fs";
|
||||
let cores = 1;
|
||||
try {
|
||||
cores = Number(process.env.THREADS) || os.cpus().length;
|
||||
@@ -48,6 +49,9 @@ if (cluster.isPrimary && process.env.NODE_ENV == "production") {
|
||||
} else {
|
||||
const port = Number(process.env.PORT) || 3001;
|
||||
|
||||
if (fs.existsSync("/proc/self/comm")) fs.writeFileSync("/proc/self/comm", `spacebar-api-${cluster.worker ? cluster.worker.id : port}`);
|
||||
process.title = `sb-api-${cluster.worker ? cluster.worker.id : port}`;
|
||||
|
||||
const server = new SpacebarServer({ port });
|
||||
server.start().catch(console.error);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user