refactor(core): Make executions pruning settings configurable (#7468)

This commit is contained in:
Iván Ovejero
2023-10-19 16:57:12 +02:00
committed by GitHub
parent c7c8048430
commit b50376cf52
2 changed files with 22 additions and 9 deletions

View File

@@ -87,8 +87,8 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
};
private rates: Record<string, number> = {
softDeletion: 1 * TIME.HOUR,
hardDeletion: config.getEnv('executions.pruneDataInterval') * TIME.MINUTE,
softDeletion: config.getEnv('executions.pruneDataIntervals.softDelete') * TIME.MINUTE,
hardDeletion: config.getEnv('executions.pruneDataIntervals.hardDelete') * TIME.MINUTE,
};
private isMainInstance = config.get('generic.instanceType') === 'main';
@@ -523,9 +523,8 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
* Permanently delete all soft-deleted executions and their binary data, in batches.
*/
private async hardDelete() {
// Find ids of all executions that were deleted over an hour ago
const date = new Date();
date.setHours(date.getHours() - 1);
date.setHours(date.getHours() - config.getEnv('executions.pruneDataHardDeleteBuffer'));
const workflowIdsAndExecutionIds = (
await this.find({