Skip to content

Commit

Permalink
impl: refresh statistics data on cron schedule (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
h4l-yup committed Jan 22, 2024
1 parent f29c876 commit c59059e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export class FeedbackIssueStatisticsService {
});
const timezoneOffset = timezone.offset;
const cronHour = (24 - Number(timezoneOffset.split(':')[0])) % 24;
const job = new CronJob(`0 ${cronHour} * * *`, async () => {
await this.createFeedbackIssueStatistics(projectId);
const job = new CronJob(`2 ${cronHour} * * *`, async () => {
await this.createFeedbackIssueStatistics(projectId, 365);
});
this.schedulerRegistry.addCronJob(
`feedback-issue-statistics-${projectId}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class FeedbackStatisticsService {
const cronHour = (24 - Number(timezoneOffset.split(':')[0])) % 24;

const job = new CronJob(`0 ${cronHour} * * *`, async () => {
await this.createFeedbackStatistics(projectId);
await this.createFeedbackStatistics(projectId, 365);
});
this.schedulerRegistry.addCronJob(`feedback-statistics-${projectId}`, job);
job.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ export class IssueStatisticsService {

const cronHour = (24 - Number(timezoneOffset.split(':')[0])) % 24;

const job = new CronJob(`0 ${cronHour} * * *`, async () => {
await this.createIssueStatistics(projectId);
const job = new CronJob(`4 ${cronHour} * * *`, async () => {
await this.createIssueStatistics(projectId, 365);
});
this.schedulerRegistry.addCronJob(`issue-statistics-${projectId}`, job);
job.start();
Expand Down

0 comments on commit c59059e

Please sign in to comment.