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),