diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2020-01-04 12:02:45 -0800 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2020-01-04 12:02:45 -0800 |
commit | 804e2f4f1d20551799a21e2fdf8e5b2b7fdebe02 (patch) | |
tree | 246ec7a474e8a0831ea8886d051619c08f8112cb /src | |
parent | ad4ac416017e7accb2df1824f3f4eda36337fa37 (diff) |
final touches
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 |