Added missing functionalities from main as part of the blueberry merge
This commit is contained in:
parent
bb4d3d146c
commit
c2161d057a
|
|
@ -0,0 +1,6 @@
|
|||
namespace Elsa.Api.Client.Resources.Alterations.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Cancels the workflow instances in an alteration plan.
|
||||
/// </summary>
|
||||
public class Cancel : AlterationBase;
|
||||
|
|
@ -154,6 +154,15 @@ public class WorkflowRuntimeFeature(IModule module) : FeatureBase(module)
|
|||
Services.Configure<WorkflowInboxCleanupOptions>(options => { options.IsEnabled = false; });
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the purge bookmark queue recurring task.
|
||||
/// </summary>
|
||||
public WorkflowRuntimeFeature DisablePurgeBookmarkQueueRecurringTask()
|
||||
{
|
||||
Services.Configure<BookmarkQueuePurgeOptions>(options => { options.IsEnabled = false; });
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register the specified workflow type.
|
||||
|
|
@ -312,7 +321,7 @@ public class WorkflowRuntimeFeature(IModule module) : FeatureBase(module)
|
|||
.AddRecurringTask<TriggerBookmarkQueueRecurringTask>(TimeSpan.FromMinutes(1))
|
||||
.AddRecurringTask<PurgeBookmarkQueueRecurringTask>(TimeSpan.FromSeconds(10))
|
||||
.AddRecurringTask<RestartInterruptedWorkflowsTask>(TimeSpan.FromMinutes(5)) // Same default as the workflow liveness threshold.
|
||||
|
||||
|
||||
// Distributed locking.
|
||||
.AddSingleton(DistributedLockProvider)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,4 +14,9 @@ public class BookmarkQueuePurgeOptions
|
|||
/// The number of records to clean up per sweep.
|
||||
/// </summary>
|
||||
public int BatchSize { get; set; } = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the bookmark queue purge is enabled.
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
}
|
||||
|
|
@ -15,6 +15,12 @@ public class DefaultBookmarkQueuePurger(IBookmarkQueueStore store, ISystemClock
|
|||
{
|
||||
public async Task PurgeAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (!options.Value.IsEnabled)
|
||||
{
|
||||
logger.LogInformation("Purging bookmark queue is disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
var currentPage = 0;
|
||||
var now = systemClock.UtcNow;
|
||||
var thresholdDate = now - options.Value.Ttl;
|
||||
|
|
|
|||
Loading…
Reference in a new issue