From c2161d057a4e9ade6b1510b1dfbfe56366cd22ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Vasile=20Vu=C8=99can?= Date: Wed, 12 Mar 2025 13:34:57 +0200 Subject: [PATCH 1/2] Added missing functionalities from main as part of the blueberry merge --- .../Resources/Alterations/Models/Cancel.cs | 6 ++++++ .../Features/WorkflowRuntimeFeature.cs | 11 ++++++++++- .../Options/BookmarkQueuePurgeOptions.cs | 5 +++++ .../Services/DefaultBookmarkQueuePurger.cs | 6 ++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/clients/Elsa.Api.Client/Resources/Alterations/Models/Cancel.cs 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; From 1ea83aff1466cb24ba7bb6a07c4e148e6c2194b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Vasile=20Vu=C8=99can?= Date: Wed, 12 Mar 2025 13:58:38 +0200 Subject: [PATCH 2/2] Removed optional purge --- .../Features/WorkflowRuntimeFeature.cs | 9 --------- .../Options/BookmarkQueuePurgeOptions.cs | 5 ----- .../Services/DefaultBookmarkQueuePurger.cs | 6 ------ 3 files changed, 20 deletions(-) diff --git a/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs b/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs index 271c2172d..aa123fe9b 100644 --- a/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs +++ b/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs @@ -154,15 +154,6 @@ 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. diff --git a/src/modules/Elsa.Workflows.Runtime/Options/BookmarkQueuePurgeOptions.cs b/src/modules/Elsa.Workflows.Runtime/Options/BookmarkQueuePurgeOptions.cs index 361955f75..b217082f5 100644 --- a/src/modules/Elsa.Workflows.Runtime/Options/BookmarkQueuePurgeOptions.cs +++ b/src/modules/Elsa.Workflows.Runtime/Options/BookmarkQueuePurgeOptions.cs @@ -14,9 +14,4 @@ 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 19120df14..9216ca9cd 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/DefaultBookmarkQueuePurger.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/DefaultBookmarkQueuePurger.cs @@ -15,12 +15,6 @@ 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;