Skip to content

Commit a6aa069

Browse files
committedNov 19, 2024
feat: increase cron schedule to every 8 hours
1 parent acd5c60 commit a6aa069

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎src/utils/helpers.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { appConfig } from "@/src/configs/app-config.ts";
22

33
export const getRandomCronSchedule = () => {
4+
// Every 8 hours at a random minute
45
const randomMinute = Math.floor(Math.random() * 60);
5-
const randomHour = Math.floor(Math.random() * 24);
6-
return `${randomMinute} ${randomHour} * * *`;
6+
const randomHour1 = Math.floor(Math.random() * 8);
7+
const randomHour2 = randomHour1 + 8;
8+
const randomHour3 = randomHour2 + 8;
9+
return `${randomMinute} ${randomHour1},${randomHour2},${randomHour3} * * *`;
710
};
811

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

0 commit comments

Comments
 (0)