Skip to content

Commit

Permalink
Merge pull request #193 from overmindtech/progress-reporting
Browse files Browse the repository at this point in the history
Improve progress reporting
  • Loading branch information
dylanratcliffe authored Feb 24, 2024
2 parents 5a70449 + c88a954 commit 78a13d8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
21 changes: 19 additions & 2 deletions cmd/changes_get_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,25 @@ fetch:
}

if riskRes.Msg.GetChangeRiskMetadata().GetRiskCalculationStatus().GetStatus() == sdp.RiskCalculationStatus_STATUS_INPROGRESS {
log.WithContext(ctx).WithField("status", riskRes.Msg.GetChangeRiskMetadata().GetRiskCalculationStatus().GetStatus().String()).Info("waiting for risk calculation")
time.Sleep(10 * time.Second)
// Extract the currently running milestone if you can
milestones := riskRes.Msg.GetChangeRiskMetadata().GetRiskCalculationStatus().GetProgressMilestones()
var currentMilestone string
for _, milestone := range milestones {
if milestone == nil {
continue
}

if milestone.GetStatus() == sdp.RiskCalculationStatus_ProgressMilestone_STATUS_INPROGRESS {
currentMilestone = milestone.GetDescription()
}
}

log.WithContext(ctx).WithFields(log.Fields{
"status": riskRes.Msg.GetChangeRiskMetadata().GetRiskCalculationStatus().GetStatus().String(),
"milestone": currentMilestone,
}).Info("Waiting for risk calculation")

time.Sleep(3 * time.Second)
// retry
} else {
// it's done (or errored)
Expand Down
8 changes: 8 additions & 0 deletions cmd/datamaps/awssource.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 78a13d8

Please sign in to comment.