Skip to content

Commit

Permalink
Add sweep interval to feature configuration
Browse files Browse the repository at this point in the history
Allow users to define their own sweep interval of the cleanup job in the
Retention module
  • Loading branch information
Sverre-W committed Dec 13, 2024
1 parent cc75bb6 commit 7049872
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/modules/Elsa.Retention/Feature/RetentionFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public RetentionFeature(IModule module) : base(module)
/// </summary>
public Action<CleanupOptions> ConfigureCleanupOptions { get; set; } = _ => { };

/// <summary>
/// Defines the run interval of the cleanup job
/// </summary>
public TimeSpan SweepInterval { get; set; } = TimeSpan.FromHours(4);

/// <inheritdoc cref="FeatureBase" />
public override void Apply()
{
Expand All @@ -44,7 +49,7 @@ public override void Apply()
Services.AddScoped<IRelatedEntityCollector, ActivityExecutionRecordCollector>();
Services.AddScoped<IRelatedEntityCollector, WorkflowExecutionLogRecordCollector>();

Services.AddRecurringTask<CleanupRecurringTask>(TimeSpan.FromHours(4));
Services.AddRecurringTask<CleanupRecurringTask>(SweepInterval);

foreach (var policy in this.GetPolicies())
{
Expand Down

0 comments on commit 7049872

Please sign in to comment.