mirror of
https://github.com/certd/certd.git
synced 2026-05-16 13:17:29 +08:00
fix: 修复从模版创建的流水线不会自动执行的bug
This commit is contained in:
@@ -47,6 +47,7 @@ import { CertInfoService } from "../../monitor/service/cert-info-service.js";
|
|||||||
import { TaskServiceBuilder } from "./getter/task-service-getter.js";
|
import { TaskServiceBuilder } from "./getter/task-service-getter.js";
|
||||||
import { nanoid } from "nanoid";
|
import { nanoid } from "nanoid";
|
||||||
import { set } from "lodash-es";
|
import { set } from "lodash-es";
|
||||||
|
import { executorQueue } from "./executor-queue.js";
|
||||||
|
|
||||||
const runningTasks: Map<string | number, Executor> = new Map();
|
const runningTasks: Map<string | number, Executor> = new Map();
|
||||||
|
|
||||||
@@ -311,7 +312,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
|||||||
},
|
},
|
||||||
where: {
|
where: {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
templateId: 0
|
isTemplate: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const ids = idEntityList.map(item => {
|
const ids = idEntityList.map(item => {
|
||||||
@@ -489,11 +490,16 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
|||||||
logger.warn("pipelineId为空,无法执行");
|
logger.warn("pipelineId为空,无法执行");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
//加入执行队列
|
||||||
await this.run(pipelineId, triggerId);
|
executorQueue.addTask({
|
||||||
} catch (e) {
|
task: async () => {
|
||||||
logger.error("定时job执行失败:", e);
|
try {
|
||||||
}
|
await this.run(pipelineId, triggerId);
|
||||||
|
} catch (e) {
|
||||||
|
logger.error("定时job执行失败:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
logger.info("当前定时器数量:", this.cron.getTaskSize());
|
logger.info("当前定时器数量:", this.cron.getTaskSize());
|
||||||
@@ -666,12 +672,13 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
|||||||
//如果不是手动触发
|
//如果不是手动触发
|
||||||
//查找trigger
|
//查找trigger
|
||||||
const found = this.findTrigger(pipeline, triggerId);
|
const found = this.findTrigger(pipeline, triggerId);
|
||||||
|
const key = this.buildCronKey(pipeline.id, triggerId);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
//如果没有找到triggerId,说明被用户删掉了,这里再删除一次
|
//如果没有找到triggerId,说明被用户删掉了,这里再删除一次
|
||||||
this.cron.remove(this.buildCronKey(pipeline.id, triggerId));
|
this.cron.remove(key);
|
||||||
triggerType = null;
|
triggerType = null;
|
||||||
} else {
|
} else {
|
||||||
logger.info("timer trigger:" + found.id, found.title, found.cron);
|
logger.info(`timer trigger:${key}, ${found.title}, ${found.props}`);
|
||||||
triggerType = "timer";
|
triggerType = "timer";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user