diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/Cancel.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/Cancel.cs
new file mode 100644
index 000000000..c616d4c3a
--- /dev/null
+++ b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/Cancel.cs
@@ -0,0 +1,6 @@
+namespace Elsa.Api.Client.Resources.Alterations.Models;
+
+///
+/// Cancels the workflow instances in an alteration plan.
+///
+public class Cancel : AlterationBase;
\ No newline at end of file
diff --git a/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs b/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs
index ec5ab8537..271c2172d 100644
--- a/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs
+++ b/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs
@@ -154,6 +154,15 @@ public class WorkflowRuntimeFeature(IModule module) : FeatureBase(module)
Services.Configure(options => { options.IsEnabled = false; });
return this;
}
+
+ ///
+ /// Disables the purge bookmark queue recurring task.
+ ///
+ public WorkflowRuntimeFeature DisablePurgeBookmarkQueueRecurringTask()
+ {
+ Services.Configure(options => { options.IsEnabled = false; });
+ return this;
+ }
///
/// Register the specified workflow type.
@@ -312,7 +321,7 @@ public class WorkflowRuntimeFeature(IModule module) : FeatureBase(module)
.AddRecurringTask(TimeSpan.FromMinutes(1))
.AddRecurringTask(TimeSpan.FromSeconds(10))
.AddRecurringTask(TimeSpan.FromMinutes(5)) // Same default as the workflow liveness threshold.
-
+
// Distributed locking.
.AddSingleton(DistributedLockProvider)
diff --git a/src/modules/Elsa.Workflows.Runtime/Options/BookmarkQueuePurgeOptions.cs b/src/modules/Elsa.Workflows.Runtime/Options/BookmarkQueuePurgeOptions.cs
index b217082f5..361955f75 100644
--- a/src/modules/Elsa.Workflows.Runtime/Options/BookmarkQueuePurgeOptions.cs
+++ b/src/modules/Elsa.Workflows.Runtime/Options/BookmarkQueuePurgeOptions.cs
@@ -14,4 +14,9 @@ public class BookmarkQueuePurgeOptions
/// The number of records to clean up per sweep.
///
public int BatchSize { get; set; } = 1000;
+
+ ///
+ /// Whether the bookmark queue purge is enabled.
+ ///
+ public bool IsEnabled { get; set; } = true;
}
\ No newline at end of file
diff --git a/src/modules/Elsa.Workflows.Runtime/Services/DefaultBookmarkQueuePurger.cs b/src/modules/Elsa.Workflows.Runtime/Services/DefaultBookmarkQueuePurger.cs
index 9216ca9cd..19120df14 100644
--- a/src/modules/Elsa.Workflows.Runtime/Services/DefaultBookmarkQueuePurger.cs
+++ b/src/modules/Elsa.Workflows.Runtime/Services/DefaultBookmarkQueuePurger.cs
@@ -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;