From 03e1eace14a1e2893b1d52705ff4689614c14ccd Mon Sep 17 00:00:00 2001 From: Jesper Justesen <1972142+FirestarJes@users.noreply.github.com> Date: Tue, 24 Sep 2024 19:03:37 +0200 Subject: [PATCH] Try another parallel pattern where the maxConcurrentActivityFunctions controls parallelisation --- .../SettlementReportOrchestration.cs | 13 +++++++++++-- .../Orchestration.SettlementReports/host.json | 3 --- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportOrchestration.cs b/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportOrchestration.cs index 8ae1f39..892948d 100644 --- a/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportOrchestration.cs +++ b/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportOrchestration.cs @@ -57,7 +57,7 @@ public async Task OrchestrateSettlementReport( context.SetCustomStatus(new OrchestrateSettlementReportMetadata { OrchestrationProgress = 10 }); - var generatedFiles = new List(); + var generatedFiles = new ConcurrentBag(); var orderedResults = scatterResults .OrderBy(x => x.PartialFileInfo.FileOffset) .ThenBy(x => x.PartialFileInfo.ChunkOffset) @@ -67,7 +67,16 @@ public async Task OrchestrateSettlementReport( .CallActivityAsync( nameof(GenerateSettlementReportFileActivity), new GenerateSettlementReportFileInput(fileRequest, settlementReportRequest.ActorInfo), - dataSourceExceptionHandler)); + dataSourceExceptionHandler).ContinueWith( + async x => + { + generatedFiles.Add(await x); + context.SetCustomStatus(new OrchestrateSettlementReportMetadata + { + OrchestrationProgress = (80.0 * generatedFiles.Count / orderedResults.Count) + 10, + }); + }, + TaskContinuationOptions.ExecuteSynchronously)); await Task.WhenAll(fileRequestTasks); diff --git a/source/settlement-report/Orchestration.SettlementReports/host.json b/source/settlement-report/Orchestration.SettlementReports/host.json index 4e18ee8..9b321b7 100644 --- a/source/settlement-report/Orchestration.SettlementReports/host.json +++ b/source/settlement-report/Orchestration.SettlementReports/host.json @@ -12,9 +12,6 @@ "isEnabled": true, "excludedTypes": "Request" }, - "logLevel": { - "default": "Information" - }, "enableLiveMetricsFilters": true } }