aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristian Fehmer <[email protected]>2023-11-30 20:22:15 +0100
committerChristian Fehmer <[email protected]>2023-11-30 20:22:22 +0100
commit94a56d049a4a22b6f8d7c93a17aa664fe4a89f23 (patch)
tree4f1aa51c63475fc592b59a44d95df7eb8307b647
parentc7e38c2f6cd9551451513a7073ec1c44ebeed14d (diff)
downloadmonkeytype-feature/dedicated-job-process.tar.gz
monkeytype-feature/dedicated-job-process.zip
-rw-r--r--backend/src/jobs/run-standalone.ts9
-rw-r--r--backend/src/server.ts8
2 files changed, 14 insertions, 3 deletions
diff --git a/backend/src/jobs/run-standalone.ts b/backend/src/jobs/run-standalone.ts
new file mode 100644
index 000000000..6433989ca
--- /dev/null
+++ b/backend/src/jobs/run-standalone.ts
@@ -0,0 +1,9 @@
+import jobs from "../jobs";
+import Logger from "../utils/logger";
+import "dotenv/config";
+
+if (process.env.STANDALONE_JOBS === "YES") {
+ Logger.info("Starting cron jobs...");
+ jobs.forEach((job) => job.start());
+ Logger.success("Cron jobs started");
+}
diff --git a/backend/src/server.ts b/backend/src/server.ts
index 01309c352..b09819778 100644
--- a/backend/src/server.ts
+++ b/backend/src/server.ts
@@ -59,9 +59,11 @@ async function bootServer(port: number): Promise<Server> {
);
}
- Logger.info("Starting cron jobs...");
- jobs.forEach((job) => job.start());
- Logger.success("Cron jobs started");
+ if (process.env.STANDALONE_JOBS !== "YES") {
+ Logger.info("Starting cron jobs...");
+ jobs.forEach((job) => job.start());
+ Logger.success("Cron jobs started");
+ }
recordServerVersion(version);
} catch (error) {