From e1bb6a52d2ea53c02620d8bfb7ccac31e8752e94 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Wed, 24 Jul 2024 22:51:06 +0200 Subject: [PATCH] Remove unnecessary namespace declarations and using statements This commit consolidates namespaces by removing redundant declarations and unused using statements across multiple files. This helps to streamline the code and improve readability, reducing potential confusion. --- .../Endpoints/WorkflowDefinitions/Refresh/Endpoint.cs | 1 + .../Endpoints/WorkflowDefinitions/Reload/Endpoint.cs | 1 + .../Elsa.Workflows.Runtime/Contracts/ILogRecordStore.cs | 2 +- .../Contracts/IWorkflowDefinitionRefresher.cs | 2 +- .../Contracts/IWorkflowDefinitionsReloader.cs | 2 +- .../ActivityExecutionPipelineBuilderExtensions.cs | 1 - .../Features/CachingWorkflowRuntimeFeature.cs | 1 - .../Features/WorkflowRuntimeFeature.cs | 1 - .../Activities/BackgroundActivityInvokerMiddleware.cs | 1 - .../Workflows/PersistActivityExecutionLogMiddleware.cs | 7 +------ .../Responses/RefreshWorkflowDefinitionsResponse.cs | 2 -- .../Services/ActivityExecutionRecordExtractor.cs | 3 +-- .../Services/StoreActivityExecutionLogSink.cs | 1 - .../Services/StoreWorkflowExecutionLogSink.cs | 5 ++--- .../Services/WorkflowDefinitionRefresher.cs | 1 - .../Services/WorkflowDefinitionsReloader.cs | 3 +-- .../Services/WorkflowExecutionLogRecordExtractor.cs | 2 +- .../Stores/MemoryBookmarkQueueStore.cs | 1 - .../WorkflowDefinitionRefresh/DynamicEndpointTests.cs | 1 + 19 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Refresh/Endpoint.cs b/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Refresh/Endpoint.cs index 8acc4c5a9..d6e312041 100644 --- a/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Refresh/Endpoint.cs +++ b/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Refresh/Endpoint.cs @@ -1,4 +1,5 @@ using Elsa.Abstractions; +using Elsa.Workflows.Runtime; using Elsa.Workflows.Runtime.Contracts; using Elsa.Workflows.Runtime.Requests; using Elsa.Workflows.Runtime.Responses; diff --git a/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Reload/Endpoint.cs b/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Reload/Endpoint.cs index 71d14f949..2f886ca69 100644 --- a/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Reload/Endpoint.cs +++ b/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowDefinitions/Reload/Endpoint.cs @@ -1,4 +1,5 @@ using Elsa.Abstractions; +using Elsa.Workflows.Runtime; using Elsa.Workflows.Runtime.Contracts; using JetBrains.Annotations; diff --git a/src/modules/Elsa.Workflows.Runtime/Contracts/ILogRecordStore.cs b/src/modules/Elsa.Workflows.Runtime/Contracts/ILogRecordStore.cs index 22f90bbc3..5e9a7cc27 100644 --- a/src/modules/Elsa.Workflows.Runtime/Contracts/ILogRecordStore.cs +++ b/src/modules/Elsa.Workflows.Runtime/Contracts/ILogRecordStore.cs @@ -1,6 +1,6 @@ using Elsa.Common.Contracts; -namespace Elsa.Workflows.Runtime.Contracts; +namespace Elsa.Workflows.Runtime; /// Represents a store of log records. public interface ILogRecordStore where T : ILogRecord diff --git a/src/modules/Elsa.Workflows.Runtime/Contracts/IWorkflowDefinitionRefresher.cs b/src/modules/Elsa.Workflows.Runtime/Contracts/IWorkflowDefinitionRefresher.cs index 579c6babb..2b71ba632 100644 --- a/src/modules/Elsa.Workflows.Runtime/Contracts/IWorkflowDefinitionRefresher.cs +++ b/src/modules/Elsa.Workflows.Runtime/Contracts/IWorkflowDefinitionRefresher.cs @@ -1,7 +1,7 @@ using Elsa.Workflows.Runtime.Requests; using Elsa.Workflows.Runtime.Responses; -namespace Elsa.Workflows.Runtime.Contracts; +namespace Elsa.Workflows.Runtime; /// Refreshes all workflows by re-indexing their triggers. public interface IWorkflowDefinitionsRefresher diff --git a/src/modules/Elsa.Workflows.Runtime/Contracts/IWorkflowDefinitionsReloader.cs b/src/modules/Elsa.Workflows.Runtime/Contracts/IWorkflowDefinitionsReloader.cs index f17d06edf..b6fabe2f2 100644 --- a/src/modules/Elsa.Workflows.Runtime/Contracts/IWorkflowDefinitionsReloader.cs +++ b/src/modules/Elsa.Workflows.Runtime/Contracts/IWorkflowDefinitionsReloader.cs @@ -1,4 +1,4 @@ -namespace Elsa.Workflows.Runtime.Contracts; +namespace Elsa.Workflows.Runtime; /// Reloads all workflows by invoking the populator. public interface IWorkflowDefinitionsReloader diff --git a/src/modules/Elsa.Workflows.Runtime/Extensions/ActivityExecutionPipelineBuilderExtensions.cs b/src/modules/Elsa.Workflows.Runtime/Extensions/ActivityExecutionPipelineBuilderExtensions.cs index 6f20c873c..30408d920 100644 --- a/src/modules/Elsa.Workflows.Runtime/Extensions/ActivityExecutionPipelineBuilderExtensions.cs +++ b/src/modules/Elsa.Workflows.Runtime/Extensions/ActivityExecutionPipelineBuilderExtensions.cs @@ -1,5 +1,4 @@ using Elsa.Workflows; -using Elsa.Workflows.Contracts; using Elsa.Workflows.Pipelines.ActivityExecution; using Elsa.Workflows.Runtime.Middleware.Activities; diff --git a/src/modules/Elsa.Workflows.Runtime/Features/CachingWorkflowRuntimeFeature.cs b/src/modules/Elsa.Workflows.Runtime/Features/CachingWorkflowRuntimeFeature.cs index bb31de5d4..b604764f0 100644 --- a/src/modules/Elsa.Workflows.Runtime/Features/CachingWorkflowRuntimeFeature.cs +++ b/src/modules/Elsa.Workflows.Runtime/Features/CachingWorkflowRuntimeFeature.cs @@ -2,7 +2,6 @@ using Elsa.Caching.Features; using Elsa.Features.Abstractions; using Elsa.Features.Attributes; using Elsa.Features.Services; -using Elsa.Workflows.Runtime.Contracts; using Elsa.Workflows.Runtime.Handlers; using Elsa.Workflows.Runtime.Stores; using Microsoft.Extensions.DependencyInjection; diff --git a/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs b/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs index 12feeb2fc..60d9b61fa 100644 --- a/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs +++ b/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs @@ -12,7 +12,6 @@ using Elsa.Workflows.Management; using Elsa.Workflows.Management.Contracts; using Elsa.Workflows.Management.Services; using Elsa.Workflows.Runtime.ActivationValidators; -using Elsa.Workflows.Runtime.Contracts; using Elsa.Workflows.Runtime.Entities; using Elsa.Workflows.Runtime.Handlers; using Elsa.Workflows.Runtime.HostedServices; diff --git a/src/modules/Elsa.Workflows.Runtime/Middleware/Activities/BackgroundActivityInvokerMiddleware.cs b/src/modules/Elsa.Workflows.Runtime/Middleware/Activities/BackgroundActivityInvokerMiddleware.cs index d47687f48..0966213ad 100644 --- a/src/modules/Elsa.Workflows.Runtime/Middleware/Activities/BackgroundActivityInvokerMiddleware.cs +++ b/src/modules/Elsa.Workflows.Runtime/Middleware/Activities/BackgroundActivityInvokerMiddleware.cs @@ -5,7 +5,6 @@ using Elsa.Workflows.Middleware.Activities; using Elsa.Workflows.Models; using Elsa.Workflows.Options; using Elsa.Workflows.Pipelines.ActivityExecution; -using Elsa.Workflows.Runtime.Middleware.Workflows; using Elsa.Workflows.Runtime.Stimuli; using JetBrains.Annotations; using Microsoft.Extensions.Logging; diff --git a/src/modules/Elsa.Workflows.Runtime/Middleware/Workflows/PersistActivityExecutionLogMiddleware.cs b/src/modules/Elsa.Workflows.Runtime/Middleware/Workflows/PersistActivityExecutionLogMiddleware.cs index 512fb616a..a9a266a59 100644 --- a/src/modules/Elsa.Workflows.Runtime/Middleware/Workflows/PersistActivityExecutionLogMiddleware.cs +++ b/src/modules/Elsa.Workflows.Runtime/Middleware/Workflows/PersistActivityExecutionLogMiddleware.cs @@ -9,12 +9,7 @@ public class PersistActivityExecutionLogMiddleware(WorkflowMiddlewareDelegate ne /// public override async ValueTask InvokeAsync(WorkflowExecutionContext context) { - // Invoke next middleware. await Next(context); - - // Get the managed cancellation token. - var cancellationToken = context.CancellationTokens.SystemCancellationToken; - - await sink.PersistExecutionLogsAsync(context, cancellationToken); + await sink.PersistExecutionLogsAsync(context); } } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Responses/RefreshWorkflowDefinitionsResponse.cs b/src/modules/Elsa.Workflows.Runtime/Responses/RefreshWorkflowDefinitionsResponse.cs index ce380a1ec..7ff496eeb 100644 --- a/src/modules/Elsa.Workflows.Runtime/Responses/RefreshWorkflowDefinitionsResponse.cs +++ b/src/modules/Elsa.Workflows.Runtime/Responses/RefreshWorkflowDefinitionsResponse.cs @@ -1,5 +1,3 @@ -using Elsa.Workflows.Management.Entities; - namespace Elsa.Workflows.Runtime.Responses; /// Represents a response to a request to refresh workflow definitions. diff --git a/src/modules/Elsa.Workflows.Runtime/Services/ActivityExecutionRecordExtractor.cs b/src/modules/Elsa.Workflows.Runtime/Services/ActivityExecutionRecordExtractor.cs index 85d02c69e..85d1db7d5 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/ActivityExecutionRecordExtractor.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/ActivityExecutionRecordExtractor.cs @@ -1,7 +1,6 @@ -using Elsa.Workflows.Runtime.Contracts; using Elsa.Workflows.Runtime.Entities; -namespace Elsa.Workflows.Runtime.Services; +namespace Elsa.Workflows.Runtime; /// Extracts activity execution log records. public class ActivityExecutionRecordExtractor(IActivityExecutionMapper activityExecutionMapper) : ILogRecordExtractor diff --git a/src/modules/Elsa.Workflows.Runtime/Services/StoreActivityExecutionLogSink.cs b/src/modules/Elsa.Workflows.Runtime/Services/StoreActivityExecutionLogSink.cs index fb32e08c5..9699497b0 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/StoreActivityExecutionLogSink.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/StoreActivityExecutionLogSink.cs @@ -1,5 +1,4 @@ using Elsa.Mediator.Contracts; -using Elsa.Workflows.Runtime.Contracts; using Elsa.Workflows.Runtime.Entities; using Elsa.Workflows.Runtime.Notifications; diff --git a/src/modules/Elsa.Workflows.Runtime/Services/StoreWorkflowExecutionLogSink.cs b/src/modules/Elsa.Workflows.Runtime/Services/StoreWorkflowExecutionLogSink.cs index b68ea2500..353ac4c0a 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/StoreWorkflowExecutionLogSink.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/StoreWorkflowExecutionLogSink.cs @@ -1,5 +1,4 @@ using Elsa.Mediator.Contracts; -using Elsa.Workflows.Runtime.Contracts; using Elsa.Workflows.Runtime.Entities; using Elsa.Workflows.Runtime.Notifications; @@ -14,7 +13,7 @@ public class StoreWorkflowExecutionLogSink(IWorkflowExecutionLogStore store, ILo public async Task PersistExecutionLogsAsync(WorkflowExecutionContext context, CancellationToken cancellationToken) { var records = extractor.ExtractLogRecords(context).ToList(); - await store.AddManyAsync(records, context.CancellationTokens.SystemCancellationToken); - await notificationSender.SendAsync(new WorkflowExecutionLogUpdated(context), context.CancellationTokens.SystemCancellationToken); + await store.AddManyAsync(records, context.CancellationToken); + await notificationSender.SendAsync(new WorkflowExecutionLogUpdated(context), context.CancellationToken); } } \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Services/WorkflowDefinitionRefresher.cs b/src/modules/Elsa.Workflows.Runtime/Services/WorkflowDefinitionRefresher.cs index 98b2d2736..f263229e9 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/WorkflowDefinitionRefresher.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/WorkflowDefinitionRefresher.cs @@ -4,7 +4,6 @@ using Elsa.Mediator.Contracts; using Elsa.Workflows.Management; using Elsa.Workflows.Management.Entities; using Elsa.Workflows.Management.Filters; -using Elsa.Workflows.Runtime.Contracts; using Elsa.Workflows.Runtime.Notifications; using Elsa.Workflows.Runtime.Requests; using Elsa.Workflows.Runtime.Responses; diff --git a/src/modules/Elsa.Workflows.Runtime/Services/WorkflowDefinitionsReloader.cs b/src/modules/Elsa.Workflows.Runtime/Services/WorkflowDefinitionsReloader.cs index f1a179e51..943632453 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/WorkflowDefinitionsReloader.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/WorkflowDefinitionsReloader.cs @@ -1,9 +1,8 @@ using Elsa.Mediator.Contracts; -using Elsa.Workflows.Runtime.Contracts; using Elsa.Workflows.Runtime.Models; using Elsa.Workflows.Runtime.Notifications; -namespace Elsa.Workflows.Runtime.Services; +namespace Elsa.Workflows.Runtime; /// public class WorkflowDefinitionsReloader(IWorkflowDefinitionStorePopulator workflowDefinitionStorePopulator, INotificationSender notificationSender) : IWorkflowDefinitionsReloader diff --git a/src/modules/Elsa.Workflows.Runtime/Services/WorkflowExecutionLogRecordExtractor.cs b/src/modules/Elsa.Workflows.Runtime/Services/WorkflowExecutionLogRecordExtractor.cs index d807fa3af..c893eb48a 100644 --- a/src/modules/Elsa.Workflows.Runtime/Services/WorkflowExecutionLogRecordExtractor.cs +++ b/src/modules/Elsa.Workflows.Runtime/Services/WorkflowExecutionLogRecordExtractor.cs @@ -1,7 +1,7 @@ using Elsa.Workflows.Contracts; using Elsa.Workflows.Runtime.Entities; -namespace Elsa.Workflows.Runtime.Services; +namespace Elsa.Workflows.Runtime; /// public class WorkflowExecutionLogRecordExtractor(IIdentityGenerator identityGenerator) : ILogRecordExtractor diff --git a/src/modules/Elsa.Workflows.Runtime/Stores/MemoryBookmarkQueueStore.cs b/src/modules/Elsa.Workflows.Runtime/Stores/MemoryBookmarkQueueStore.cs index f9f9cced9..80f34ca2f 100644 --- a/src/modules/Elsa.Workflows.Runtime/Stores/MemoryBookmarkQueueStore.cs +++ b/src/modules/Elsa.Workflows.Runtime/Stores/MemoryBookmarkQueueStore.cs @@ -1,4 +1,3 @@ -using Elsa.Common.Entities; using Elsa.Common.Models; using Elsa.Common.Services; using Elsa.Extensions; diff --git a/test/component/Elsa.Workflows.ComponentTests/Scenarios/WorkflowDefinitionRefresh/DynamicEndpointTests.cs b/test/component/Elsa.Workflows.ComponentTests/Scenarios/WorkflowDefinitionRefresh/DynamicEndpointTests.cs index c79de6de1..d17d703b3 100644 --- a/test/component/Elsa.Workflows.ComponentTests/Scenarios/WorkflowDefinitionRefresh/DynamicEndpointTests.cs +++ b/test/component/Elsa.Workflows.ComponentTests/Scenarios/WorkflowDefinitionRefresh/DynamicEndpointTests.cs @@ -1,6 +1,7 @@ using System.Net; using Elsa.Testing.Shared.Services; using Elsa.Workflows.ComponentTests.Helpers; +using Elsa.Workflows.Runtime; using Elsa.Workflows.Runtime.Contracts; using Microsoft.Extensions.DependencyInjection;