perf: 优化pipeline删除时,删除其他history

This commit is contained in:
xiaojunnuo
2024-08-05 12:57:13 +08:00
parent f78ae93eed
commit b4252033d5
4 changed files with 25 additions and 0 deletions
@@ -142,4 +142,21 @@ export class HistoryService extends BaseService<HistoryEntity> {
});
await this.logService.deleteByHistoryIds(ids);
}
async deleteByPipelineId(id: number) {
await this.repository.delete({
pipelineId: id,
});
try {
const fileStore = new FileStore({
rootDir: this.certdConfig.fileRootDir,
scope: id + '',
parent: '0',
});
fileStore.deleteByParent(id + '', '');
} catch (e) {
logger.error('删除文件失败', e);
}
}
}