Skip to content

Commit

Permalink
chore: increase job frequency to every 6 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
wei committed Nov 21, 2024
1 parent 9b6357e commit 1c12d9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/processor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export function getRepoProcessor(probot: Probot) {

log.info(`✅ Repo job processed successfully`);
} catch (error) {
const message = error instanceof Error ? error.message : "Unknown error";
log.error(error, `❌ Repo job failed: ${message}`);
log.error(error, "❌ Repo job failed");
}
};
}
11 changes: 6 additions & 5 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { appConfig } from "@/src/configs/app-config.ts";

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

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

0 comments on commit 1c12d9b

Please sign in to comment.