perf: 流水线支持有效期设置

This commit is contained in:
xiaojunnuo
2025-10-21 23:23:56 +08:00
parent 77b4a1eaf6
commit 911e69e3bc
6 changed files with 50 additions and 23 deletions
@@ -457,11 +457,11 @@ export class PipelineService extends BaseService<PipelineEntity> {
return;
}
cron = cron.trim();
if (cron.startsWith("* *")) {
cron = cron.replace("\* \*", "0 0");
if (cron.startsWith("* * ")) {
cron = "0 0 " + cron.substring(5);
}
if (cron.startsWith("*")) {
cron = cron.replace("\*", "0");
if (cron.startsWith("* ")) {
cron = "0 " + cron.substring(2);
}
const triggerId = trigger.id;
const name = this.buildCronKey(pipelineId, triggerId);
@@ -493,6 +493,9 @@ export class PipelineService extends BaseService<PipelineEntity> {
*/
async run(id: number, triggerId: string, stepId?: string) {
const entity: PipelineEntity = await this.info(id);
if (entity.validTime > 0 && entity.validTime < Date.now()) {
return;
}
await this.doRun(entity, triggerId, stepId);
}