Skip to content

Commit

Permalink
fix(status): retry limit for status check errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrt committed Jun 30, 2022
1 parent 50b36f8 commit f086b9a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,19 @@ func (s *StatusOptions) Print(cmd *cobra.Command) error {
return err
}

tries := 1
return wait2.PollImmediateInfiniteWithContext(cmd.Context(), StatusInterval, func(ctx context.Context) (done bool, err error) {
if tries == StatusRetryLimit {
// we hit back-to-back errors too many times.
return true, errors.New("retry limit reached checking status")
}
err = s.Update()
if err != nil {
return false, err
tries++ // increment retries sinc we hit error.
log.Error(err)
return false, nil
}
tries = 1 // reset retries
return s.doPrint(cmd)
})
}
Expand Down

0 comments on commit f086b9a

Please sign in to comment.