diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/index.ts | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/server/index.ts b/src/server/index.ts index 4dabf612d..3c1839e4d 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -27,14 +27,6 @@ import { Session } from "./Session/session"; import { isMaster } from "cluster"; import { execSync } from "child_process"; -if (isMaster) { - Session.initializeMaster().then(({ registerCommand }) => { - registerCommand("pull", [], () => execSync("git pull", { stdio: ["ignore", "inherit", "inherit"] })); - }); -} else { - Session.initializeWorker(launch); -} - export const publicDirectory = path.resolve(__dirname, "public"); export const filesDirectory = path.resolve(publicDirectory, "files"); @@ -136,11 +128,20 @@ function routeSetter({ isRelease, addSupervisedRoute, logRegistrationOutcome }: WebSocket.initialize(serverPort, isRelease); } -async function launch() { - await log_execution({ - startMessage: "\nstarting execution of preliminary functions", - endMessage: "completed preliminary functions\n", - action: preliminaryFunctions +/** + * Thread dependent session initialization + */ +if (isMaster) { + Session.initializeMaster().then(({ registerCommand }) => { + registerCommand("pull", [], () => execSync("git pull", { stdio: ["ignore", "inherit", "inherit"] })); + }); +} else { + Session.initializeWorker(async () => { + await log_execution({ + startMessage: "\nstarting execution of preliminary functions", + endMessage: "completed preliminary functions\n", + action: preliminaryFunctions + }); + await initializeServer({ serverPort: 1050, routeSetter }); }); - await initializeServer({ serverPort: 1050, routeSetter }); }
\ No newline at end of file |