aboutsummaryrefslogtreecommitdiff
path: root/src/server/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/index.ts')
-rw-r--r--src/server/index.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/server/index.ts b/src/server/index.ts
index 795418b31..bebb9b365 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -23,7 +23,7 @@ import GeneralGoogleManager from "./ApiManagers/GeneralGoogleManager";
import GooglePhotosManager from "./ApiManagers/GooglePhotosManager";
import { yellow, red } from "colors";
import { disconnect } from "../server/Initialization";
-import { ProcessManager } from "./ProcessManager";
+import { ProcessFactory, Logger } from "./ChildProcessUtilities/ProcessFactory";
export const publicDirectory = path.resolve(__dirname, "public");
export const filesDirectory = path.resolve(publicDirectory, "files");
@@ -36,7 +36,7 @@ export const ExitHandlers = new Array<() => void>();
* before clients can access the server should be run or awaited here.
*/
async function preliminaryFunctions() {
- await ProcessManager.initialize();
+ await Logger.initialize();
await GoogleCredentialsLoader.loadCredentials();
GoogleApiServerUtils.processProjectCredentials();
await DashUploadUtils.buildFileDirectories();
@@ -121,11 +121,16 @@ function routeSetter({ isRelease, addSupervisedRoute, logRegistrationOutcome }:
}
});
+ let daemonInitialized = false;
+ const { SPAWNED, RELEASE } = process.env;
addSupervisedRoute({
method: Method.GET,
subscription: "/persist",
onValidation: ({ res }) => {
- ProcessManager.trySpawnDaemon();
+ if (RELEASE && !SPAWNED && !daemonInitialized) {
+ daemonInitialized = true;
+ ProcessFactory.NamedAgents.persistenceDaemon();
+ }
res.redirect("/home");
}
});