From 524b5df7231635682053d0c028b0a24189b875ab Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Thu, 12 Aug 2021 20:09:35 +0200 Subject: :sparkles: api --- src/start.ts | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 src/start.ts (limited to 'src/start.ts') diff --git a/src/start.ts b/src/start.ts deleted file mode 100644 index d799c190..00000000 --- a/src/start.ts +++ /dev/null @@ -1,32 +0,0 @@ -process.on("uncaughtException", console.error); -process.on("unhandledRejection", console.error); - -import "missing-native-js-functions"; -import { config } from "dotenv"; -config(); -import { FosscordServer } from "./Server"; -import cluster from "cluster"; -import os from "os"; -const cores = Number(process.env.threads) || os.cpus().length; - -if (cluster.isMaster && process.env.NODE_ENV == "production") { - console.log(`Primary ${process.pid} is running`); - - // Fork workers. - for (let i = 0; i < cores; i++) { - cluster.fork(); - } - - cluster.on("exit", (worker, code, signal) => { - console.log(`worker ${worker.process.pid} died, restart worker`); - cluster.fork(); - }); -} else { - var port = Number(process.env.PORT) || 3001; - - const server = new FosscordServer({ port }); - server.start().catch(console.error); - - // @ts-ignore - global.server = server; -} -- cgit 1.5.1