fix: 修复在相同的cron时偶尔无法触发定时任务的bug

This commit is contained in:
xiaojunnuo
2024-08-03 23:32:50 +08:00
parent 1cf8d4e5e7
commit 680941af11
8 changed files with 101 additions and 34 deletions
@@ -120,7 +120,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
}
}
}
logger.info('定时器数量:', this.cron.getListSize());
logger.info('定时器数量:', this.cron.getTaskSize());
}
async registerTriggers(pipeline?: Pipeline, immediateTriggerOnce = false) {
@@ -193,7 +193,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
}
},
});
logger.info('当前定时器数量:', this.cron.getListSize());
logger.info('当前定时器数量:', this.cron.getTaskSize());
}
async run(id: number, triggerId: string) {
@@ -212,6 +212,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
const onChanged = async (history: RunHistory) => {
//保存执行历史
try {
logger.info('保存执行历史:', history.id);
await this.saveHistory(history);
} catch (e) {
const pipelineEntity = new PipelineEntity();