Skip to content

Commit

Permalink
add retry when refresh cred
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed Aug 15, 2023
1 parent bbb50da commit 962fee4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/credentials/provider/updater.go
Expand Up @@ -88,8 +88,13 @@ func (u *Updater) refreshCredForLoop(ctx context.Context) {
u.logger().Debug(fmt.Sprintf("start refresh credentials, current expiration: %s",
exp.Format("2006-01-02T15:04:05Z")))

// TODO: add retry
_ = u.refreshCred(ctx)
for i := 0; i < 5; i++ {
err := u.refreshCred(ctx)
if _, ok := err.(*NotEnableError); ok {
return
}
time.Sleep(time.Second * time.Duration(i))
}
}

func (u *Updater) refreshCred(ctx context.Context) error {
Expand Down

0 comments on commit 962fee4

Please sign in to comment.