mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-09-22 18:10:42 +02:00
fix(core): Restore old names for pruning config keys (#11782)
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user