Merge pull request #6418 from elsa-workflows/enh/disable-bg-jobs-blueberry
Add toggle for WorkflowInboxCleanupJob in WorkflowRuntimeFeature
This commit is contained in:
commit
548272fb01
1
.github/workflows/packages.yml
vendored
1
.github/workflows/packages.yml
vendored
|
|
@ -5,6 +5,7 @@ on:
|
|||
branches:
|
||||
- 'blueberry'
|
||||
- 'feature/*'
|
||||
- 'enh/*'
|
||||
release:
|
||||
types: [ prereleased, published ]
|
||||
env:
|
||||
|
|
|
|||
|
|
@ -29,12 +29,9 @@ namespace Elsa.Workflows.Runtime.Features;
|
|||
/// Installs and configures workflow runtime features.
|
||||
/// </summary>
|
||||
[DependsOn(typeof(SystemClockFeature))]
|
||||
public class WorkflowRuntimeFeature : FeatureBase
|
||||
public class WorkflowRuntimeFeature(IModule module) : FeatureBase(module)
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public WorkflowRuntimeFeature(IModule module) : base(module)
|
||||
{
|
||||
}
|
||||
private bool _enableWorkflowInboxCleanupJob = true;
|
||||
|
||||
private IDictionary<string, DispatcherChannel> WorkflowDispatcherChannels { get; set; } = new Dictionary<string, DispatcherChannel>();
|
||||
|
||||
|
|
@ -126,12 +123,30 @@ public class WorkflowRuntimeFeature : FeatureBase
|
|||
/// A delegate to configure the <see cref="WorkflowInboxCleanupOptions"/>.
|
||||
/// </summary>
|
||||
public Action<WorkflowInboxCleanupOptions> WorkflowInboxCleanupOptions { get; set; } = _ => { };
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A delegate to configure the <see cref="WorkflowDispatcherOptions"/>.
|
||||
/// </summary>
|
||||
public Action<WorkflowDispatcherOptions> WorkflowDispatcherOptions { get; set; } = _ => { };
|
||||
|
||||
/// <summary>
|
||||
/// Enables the workflow inbox cleanup job.
|
||||
/// </summary>
|
||||
public WorkflowRuntimeFeature EnableWorkflowInboxCleanupJob()
|
||||
{
|
||||
_enableWorkflowInboxCleanupJob = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the workflow inbox cleanup job.
|
||||
/// </summary>
|
||||
public WorkflowRuntimeFeature DisableWorkflowInboxCleanupJob()
|
||||
{
|
||||
_enableWorkflowInboxCleanupJob = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register the specified workflow type.
|
||||
/// </summary>
|
||||
|
|
@ -188,7 +203,7 @@ public class WorkflowRuntimeFeature : FeatureBase
|
|||
public override void ConfigureHostedServices()
|
||||
{
|
||||
Module.ConfigureHostedService<PopulateRegistriesHostedService>();
|
||||
Module.ConfigureHostedService<WorkflowInboxCleanupHostedService>();
|
||||
if (_enableWorkflowInboxCleanupJob) Module.ConfigureHostedService<WorkflowInboxCleanupHostedService>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
@ -240,7 +255,7 @@ public class WorkflowRuntimeFeature : FeatureBase
|
|||
.AddScoped<IWorkflowCancellationService, WorkflowCancellationService>()
|
||||
.AddScoped<ILogRecordExtractor<ActivityExecutionRecord>, ActivityExecutionRecordExtractor>()
|
||||
.AddScoped<ILogRecordExtractor<WorkflowExecutionLogRecord>, WorkflowExecutionLogRecordExtractor>()
|
||||
|
||||
|
||||
// Stores.
|
||||
.AddScoped(BookmarkStore)
|
||||
.AddScoped(TriggerStore)
|
||||
|
|
|
|||
Loading…
Reference in a new issue