summary refs log tree commit diff
path: root/src/start.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-12 20:09:35 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-12 20:09:35 +0200
commit524b5df7231635682053d0c028b0a24189b875ab (patch)
tree38bdb481e6149a825170cb67cb961410de92efdd /src/start.ts
parentnpm i @fosscord/server-util@1.3.52 (diff)
downloadserver-524b5df7231635682053d0c028b0a24189b875ab.tar.xz
:sparkles: api
Diffstat (limited to 'src/start.ts')
-rw-r--r--src/start.ts32
1 files changed, 0 insertions, 32 deletions
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; -}