From 62ffd6c1f1272d5681a795e6feacd96d9e0d68dc Mon Sep 17 00:00:00 2001 From: Jesper Justesen Date: Mon, 23 Sep 2024 12:40:57 +0200 Subject: [PATCH] Update to actually be parallel --- .../SettlementReports/SettlementReportOrchestration.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportOrchestration.cs b/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportOrchestration.cs index adc4727..d3c3ea0 100644 --- a/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportOrchestration.cs +++ b/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportOrchestration.cs @@ -61,7 +61,7 @@ public async Task OrchestrateSettlementReport( .ThenBy(x => x.PartialFileInfo.ChunkOffset) .ToList(); - foreach (var fileRequest in orderedResults.AsParallel().WithDegreeOfParallelism(5)) + await Parallel.ForEachAsync(orderedResults, new ParallelOptions { MaxDegreeOfParallelism = 5 }, async (fileRequest, token) => { var result = await context .CallActivityAsync( @@ -75,7 +75,7 @@ public async Task OrchestrateSettlementReport( { OrchestrationProgress = (80.0 * generatedFiles.Count / orderedResults.Count) + 10, }); - } + }); var generatedSettlementReport = await context.CallActivityAsync( nameof(GatherSettlementReportFilesActivity),