in internal/conn/storage/credcache.go [130:154]
func (c *credCache) refresh(ctx context.Context, boff *exponential.Backoff, next time.Time) error {
select {
case <-c.closeCh:
return errors.New("closed")
case <-time.After(next.Sub(c.now())):
// This will retry forever. On any failures it will log the error and continue.
// Every retry can only take up to 30 seconds. Uses the default policy which has a
// maximum time of 1min - 1min30s between attempts.
err := boff.Retry(ctx, func(ctx context.Context, r exponential.Record) error {
select {
case <-c.closeCh:
return fmt.Errorf("credCache closed: %w", exponential.ErrPermanent)
default:
}
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
if err := c.refreshCred(ctx, c.now().UTC()); err != nil {
c.log.Error(fmt.Sprintf("credCache: problem refreshing credential: %s", err.Error()))
return err
}
return nil
})
return err
}
}