Skip to content

Commit

Permalink
check failed status only for currently running reports
Browse files Browse the repository at this point in the history
  • Loading branch information
vbelinschi committed Sep 19, 2024
1 parent a335c05 commit 2319938
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,23 @@ private async Task<IEnumerable<RequestedSettlementReportDto>> CheckStatusOfSettl
foreach (var settlementReport in settlementReports)
{
var updatedReport = settlementReport;
if (settlementReport.JobId == null)
{
var instanceInfo = await durableTaskClient
.GetInstanceAsync(settlementReport.RequestId.Id, getInputsAndOutputs: true)
.ConfigureAwait(false);

if (instanceInfo == null)
{
// If the orchestration instance is not found, we assume it is running on the other orchestration,
// either the heavy or the light one
continue;
}
var instanceInfo = await durableTaskClient
.GetInstanceAsync(settlementReport.RequestId.Id, getInputsAndOutputs: true)
.ConfigureAwait(false);

if (instanceInfo == null)
{
// If the orchestration instance is not found, we assume it is running on the other orchestration,
// either the heavy or the light one
continue;
}

if (settlementReport.Status == SettlementReportStatus.InProgress)
{
if (instanceInfo.RuntimeStatus
is not OrchestrationRuntimeStatus.Running
and not OrchestrationRuntimeStatus.Pending
and not OrchestrationRuntimeStatus.Suspended)
is OrchestrationRuntimeStatus.Terminated
or OrchestrationRuntimeStatus.Failed)
{
await _updateFailedSettlementReportsHandler
.UpdateFailedReportAsync(settlementReport.RequestId)
Expand All @@ -130,9 +130,9 @@ await _updateFailedSettlementReportsHandler
updatedReport = updatedReport with { Progress = customStatus.OrchestrationProgress };
}
}

finalSettlementReports.Add(updatedReport);
}

finalSettlementReports.Add(updatedReport);
}

return finalSettlementReports;
Expand Down

0 comments on commit 2319938

Please sign in to comment.