mirror of
https://github.com/certd/certd.git
synced 2026-04-24 20:57:26 +08:00
chore: pipeline valid time add to plus
This commit is contained in:
@@ -485,6 +485,17 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
|||||||
logger.info("当前定时器数量:", this.cron.getTaskSize());
|
logger.info("当前定时器数量:", this.cron.getTaskSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async isPipelineValidTimeEnabled(entity: PipelineEntity) {
|
||||||
|
const settings = await this.sysSettingsService.getPublicSettings();
|
||||||
|
if (isPlus() && settings.pipelineValidTimeEnabled){
|
||||||
|
if (entity.validTime > 0 && entity.validTime < Date.now()){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
@@ -493,7 +504,9 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
|||||||
*/
|
*/
|
||||||
async run(id: number, triggerId: string, stepId?: string) {
|
async run(id: number, triggerId: string, stepId?: string) {
|
||||||
const entity: PipelineEntity = await this.info(id);
|
const entity: PipelineEntity = await this.info(id);
|
||||||
if (entity.validTime > 0 && entity.validTime < Date.now()) {
|
const validTimeEnabled = await this.isPipelineValidTimeEnabled(entity)
|
||||||
|
if (!validTimeEnabled) {
|
||||||
|
logger.info(`流水线${id}已过期,不予执行`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.doRun(entity, triggerId, stepId);
|
await this.doRun(entity, triggerId, stepId);
|
||||||
|
|||||||
Reference in New Issue
Block a user