Skip to content

Commit

Permalink
Try another parallel pattern where the maxConcurrentActivityFunctions…
Browse files Browse the repository at this point in the history
… controls parallelisation
  • Loading branch information
FirestarJes committed Sep 24, 2024
1 parent e333f8f commit 03e1eac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public async Task<string> OrchestrateSettlementReport(

context.SetCustomStatus(new OrchestrateSettlementReportMetadata { OrchestrationProgress = 10 });

var generatedFiles = new List<GeneratedSettlementReportFileDto>();
var generatedFiles = new ConcurrentBag<GeneratedSettlementReportFileDto>();
var orderedResults = scatterResults
.OrderBy(x => x.PartialFileInfo.FileOffset)
.ThenBy(x => x.PartialFileInfo.ChunkOffset)
Expand All @@ -67,7 +67,16 @@ public async Task<string> OrchestrateSettlementReport(
.CallActivityAsync<GeneratedSettlementReportFileDto>(
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
"isEnabled": true,
"excludedTypes": "Request"
},
"logLevel": {
"default": "Information"
},
"enableLiveMetricsFilters": true
}
}
Expand Down

0 comments on commit 03e1eac

Please sign in to comment.