Skip to content

Commit

Permalink
feat: increase cron schedule to every 8 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
wei committed Nov 19, 2024
1 parent acd5c60 commit a6aa069
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { appConfig } from "@/src/configs/app-config.ts";

export const getRandomCronSchedule = () => {
// Every 8 hours at a random minute
const randomMinute = Math.floor(Math.random() * 60);
const randomHour = Math.floor(Math.random() * 24);
return `${randomMinute} ${randomHour} * * *`;
const randomHour1 = Math.floor(Math.random() * 8);
const randomHour2 = randomHour1 + 8;
const randomHour3 = randomHour2 + 8;
return `${randomMinute} ${randomHour1},${randomHour2},${randomHour3} * * *`;
};

export const timeout = (ms: number): Promise<void> =>
Expand Down

0 comments on commit a6aa069

Please sign in to comment.