Skip to content

Commit 78d5532

Browse files
committed
feat: run analytics upload immediately on start gf-592 (#592)
1 parent de6d38a commit 78d5532

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

apps/backend/src/libs/modules/task-scheduler/base-task-scheduler.module.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ class BaseTaskScheduler implements TaskScheduler {
1616
}
1717

1818
public start(schedule: string, task: () => void): void {
19-
cron.schedule(schedule, () => {
20-
task();
21-
});
19+
cron.schedule(
20+
schedule,
21+
() => {
22+
task();
23+
},
24+
{ runOnInit: true },
25+
);
2226
this.logger.info(
2327
`Task is scheduled to run according to the pattern: ${schedule}.`,
2428
);

scripts/analytics/src/libs/modules/task-scheduler/base-task-scheduler.module.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ class BaseTaskScheduler implements TaskScheduler {
1616
}
1717

1818
public start(schedule: string, task: () => void): void {
19-
cron.schedule(schedule, () => {
20-
task();
21-
});
19+
cron.schedule(
20+
schedule,
21+
() => {
22+
task();
23+
},
24+
{ runOnInit: true },
25+
);
2226
this.logger.info(
2327
`Task is scheduled to run according to the pattern: ${schedule}.`,
2428
);

0 commit comments

Comments
 (0)