Skip to content

Commit

Permalink
Only start cron jobs in demo instance
Browse files Browse the repository at this point in the history
  • Loading branch information
JackBailey committed Apr 30, 2023
1 parent 7907368 commit e4d6534
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/modules/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const regenSecrets = async () => {
const oldLinkDeletionJob = new CronJob({
cronTime: "0 * * * * *",
onTick: () => {
if (process.env.DEMO === "true") removeDemoLinks();
removeDemoLinks();
},
runOnInit: true,
timeZone: "UTC",
Expand All @@ -36,14 +36,16 @@ const oldLinkDeletionJob = new CronJob({
const secretRegenJob = new CronJob({
cronTime: "0 0 * * * *",
onTick: () => {
if (process.env.DEMO === "true") regenSecrets();
regenSecrets();
},
runOnInit: true,
timeZone: "UTC",
});

module.exports.start = () => {
console.log("Backend started!");
oldLinkDeletionJob.start();
secretRegenJob.start();
if (process.env.DEMO == "true") {
oldLinkDeletionJob.start();
secretRegenJob.start();
}
};

0 comments on commit e4d6534

Please sign in to comment.