diff --git a/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportListHttpTrigger.cs b/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportListHttpTrigger.cs index 01a1700..3d3761a 100644 --- a/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportListHttpTrigger.cs +++ b/source/settlement-report/Orchestration.SettlementReports/Functions/SettlementReports/SettlementReportListHttpTrigger.cs @@ -99,40 +99,43 @@ private async Task> CheckStatusOfSettl { var updatedReport = settlementReport; - var instanceInfo = await durableTaskClient - .GetInstanceAsync(settlementReport.RequestId.Id, getInputsAndOutputs: true) - .ConfigureAwait(false); - - if (instanceInfo == null) + if (settlementReport.Status == SettlementReportStatus.InProgress && settlementReport.JobId == 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 (settlementReport.Status == SettlementReportStatus.InProgress) - { - if (instanceInfo.RuntimeStatus - is OrchestrationRuntimeStatus.Terminated - or OrchestrationRuntimeStatus.Failed) + if (instanceInfo == null) { - await _updateFailedSettlementReportsHandler - .UpdateFailedReportAsync(settlementReport.RequestId) - .ConfigureAwait(false); - - updatedReport = settlementReport with { Status = SettlementReportStatus.Failed }; + // If the orchestration instance is not found, we assume it is running on the other orchestration, + // either the heavy or the light one + continue; } - else + + if (settlementReport.Status == SettlementReportStatus.InProgress) { - var customStatus = instanceInfo.ReadCustomStatusAs(); - if (customStatus != null) + if (instanceInfo.RuntimeStatus + is OrchestrationRuntimeStatus.Terminated + or OrchestrationRuntimeStatus.Failed) { - updatedReport = updatedReport with { Progress = customStatus.OrchestrationProgress }; + await _updateFailedSettlementReportsHandler + .UpdateFailedReportAsync(settlementReport.RequestId) + .ConfigureAwait(false); + + updatedReport = settlementReport with { Status = SettlementReportStatus.Failed }; + } + else + { + var customStatus = instanceInfo.ReadCustomStatusAs(); + if (customStatus != null) + { + updatedReport = updatedReport with { Progress = customStatus.OrchestrationProgress }; + } } } - } - finalSettlementReports.Add(updatedReport); + finalSettlementReports.Add(updatedReport); + } } return finalSettlementReports; diff --git a/source/settlement-report/SettlementReports.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs b/source/settlement-report/SettlementReports.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs index 11263ba..740480e 100644 --- a/source/settlement-report/SettlementReports.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs +++ b/source/settlement-report/SettlementReports.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs @@ -63,7 +63,7 @@ internal string BuildDebugString(DatabricksSqlQueryable query) private IAsyncEnumerable ExecuteCoreAsync(DatabricksStatement databricksStatement, CancellationToken cancellationToken = default) { - var rows = _databricksSqlWarehouseQueryExecutor.ExecuteStatementAsync(databricksStatement, QueryOptions.WithFormat(Format.JsonArray).WithParallelDownload(), cancellationToken); + var rows = _databricksSqlWarehouseQueryExecutor.ExecuteStatementAsync(databricksStatement, QueryOptions.WithFormat(Format.JsonArray), cancellationToken); return _sqlRowHydrator.HydrateAsync(rows, cancellationToken); }