feat(core): Make executions pruning interval configurable (#7439)

This commit is contained in:
Iván Ovejero 2023-10-18 17:01:57 +02:00 committed by GitHub
parent 79f23fb939
commit 40707fa692
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -305,7 +305,7 @@ export const schema = {
},
// To not exceed the database's capacity and keep its size moderate
// the execution data gets pruned regularly (default: 1 hour interval).
// the execution data gets pruned regularly (default: 15 minute interval).
// All saved execution data older than the max age will be deleted.
// Pruning is currently not activated by default, which will change in
// a future version.
@ -321,6 +321,12 @@ export const schema = {
default: 336,
env: 'EXECUTIONS_DATA_MAX_AGE',
},
pruneDataInterval: {
doc: 'How often (minutes) execution data should be hard-deleted',
format: Number,
default: 15,
env: 'EXECUTIONS_DATA_PRUNE_INTERVAL',
},
// Additional pruning option to delete executions if total count exceeds the configured max.
// Deletes the oldest entries first

View file

@ -88,7 +88,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
private rates: Record<string, number> = {
softDeletion: 1 * TIME.HOUR,
hardDeletion: 15 * TIME.MINUTE,
hardDeletion: config.getEnv('executions.pruneDataInterval') * TIME.MINUTE,
};
private isMainInstance = config.get('generic.instanceType') === 'main';