Skip to content

Commit

Permalink
address the comment
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Feb 8, 2024
1 parent 505623e commit bf013b5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/mcs/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,21 @@ func WaitAPIServiceReady(s server) error {
)
ticker := time.NewTicker(RetryIntervalWaitAPIService)
defer ticker.Stop()
retryTimes := 0
for {
ready, err = isAPIServiceReady(s)
if err == nil && ready {
return nil
}
log.Debug("api server is not ready, retrying", errs.ZapError(err), zap.Bool("ready", ready))
select {
case <-s.Context().Done():
return errors.New("context canceled while waiting api server ready")
case <-ticker.C:
retryTimes++
if retryTimes/500 > 0 {
log.Warn("api server is not ready, retrying", errs.ZapError(err))
retryTimes /= 500

Check warning on line 139 in pkg/mcs/utils/util.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/utils/util.go#L138-L139

Added lines #L138 - L139 were not covered by tests
}
}
}
}
Expand Down

0 comments on commit bf013b5

Please sign in to comment.