fix(core): Restore old names for pruning config keys (#11782)

This commit is contained in:
Iván Ovejero
2024-11-20 09:56:37 +01:00
committed by GitHub
parent e1dacb4d57
commit d15b8d0509
9 changed files with 61 additions and 53 deletions
@@ -459,7 +459,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
}
async softDeletePrunableExecutions() {
const { maxAge, maxCount } = this.globalConfig.pruning;
const { pruneDataMaxAge, pruneDataMaxCount } = this.globalConfig.executions;
// Sub-query to exclude executions having annotations
const annotatedExecutionsSubQuery = this.manager
@@ -470,18 +470,18 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
// Find ids of all executions that were stopped longer that pruneDataMaxAge ago
const date = new Date();
date.setHours(date.getHours() - maxAge);
date.setHours(date.getHours() - pruneDataMaxAge);
const toPrune: Array<FindOptionsWhere<ExecutionEntity>> = [
// date reformatting needed - see https://github.com/typeorm/typeorm/issues/2286
{ stoppedAt: LessThanOrEqual(DateUtils.mixedDateToUtcDatetimeString(date)) },
];
if (maxCount > 0) {
if (pruneDataMaxCount > 0) {
const executions = await this.createQueryBuilder('execution')
.select('execution.id')
.where('execution.id NOT IN ' + annotatedExecutionsSubQuery.getQuery())
.skip(maxCount)
.skip(pruneDataMaxCount)
.take(1)
.orderBy('execution.id', 'DESC')
.getMany();
@@ -515,7 +515,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
async findSoftDeletedExecutions() {
const date = new Date();
date.setHours(date.getHours() - this.globalConfig.pruning.hardDeleteBuffer);
date.setHours(date.getHours() - this.globalConfig.executions.pruneDataHardDeleteBuffer);
const workflowIdsAndExecutionIds = (
await this.find({