From 7049872fa9a1e3fbf8e8db5eb36a0e5482cacf5a Mon Sep 17 00:00:00 2001 From: Sverre Winkelmans Date: Fri, 13 Dec 2024 10:08:25 +0800 Subject: [PATCH] Add sweep interval to feature configuration Allow users to define their own sweep interval of the cleanup job in the Retention module --- src/modules/Elsa.Retention/Feature/RetentionFeature.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/Elsa.Retention/Feature/RetentionFeature.cs b/src/modules/Elsa.Retention/Feature/RetentionFeature.cs index cd8b661d2e..f299229094 100644 --- a/src/modules/Elsa.Retention/Feature/RetentionFeature.cs +++ b/src/modules/Elsa.Retention/Feature/RetentionFeature.cs @@ -30,6 +30,11 @@ public RetentionFeature(IModule module) : base(module) /// public Action ConfigureCleanupOptions { get; set; } = _ => { }; + /// + /// Defines the run interval of the cleanup job + /// + public TimeSpan SweepInterval { get; set; } = TimeSpan.FromHours(4); + /// public override void Apply() { @@ -44,7 +49,7 @@ public override void Apply() Services.AddScoped(); Services.AddScoped(); - Services.AddRecurringTask(TimeSpan.FromHours(4)); + Services.AddRecurringTask(SweepInterval); foreach (var policy in this.GetPolicies()) {