perf: 支持配置启动后自动触发一次任务

This commit is contained in:
xiaojunnuo
2024-07-21 02:32:03 +08:00
parent affef13037
commit a5a0c1f6e7
3 changed files with 5 additions and 4 deletions
@@ -8,9 +8,6 @@ const production = {
preview: {
enabled: false,
},
cron: {
immediateTriggerOnce: true,
},
} as MidwayConfig;
mergeConfig(production, 'production');
@@ -9,8 +9,10 @@ export type CronTask = {
};
export class Cron {
logger;
immediateTriggerOnce: boolean;
constructor(opts) {
this.logger = opts.logger;
this.immediateTriggerOnce = opts.immediateTriggerOnce;
}
register(task: CronTask) {