Skip to content

Commit

Permalink
Added logging of milestone to progress reporting
Browse files Browse the repository at this point in the history
This should improve the output for CI
  • Loading branch information
dylanratcliffe committed Feb 23, 2024
1 parent 5a70449 commit 19ce2b5
Showing 1 changed file with 19 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.Status == 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

0 comments on commit 19ce2b5

Please sign in to comment.