Skip to content

Commit 5ce46c8

Browse files
committed
fix: stop re-exchanging token when expiry is zero
A token with no expiry should be treated as valid indefinitely. The previous loop re-fetched a new token every 5 seconds instead of blocking until context cancellation.
1 parent efca378 commit 5ce46c8

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

pkg/rfc7523/rfc7523.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,10 @@ func (cp *credentialsProvider) refreshCredentialsLoop(
189189
cp.logger.V(1).Info("token sent", "expires", tok.Expiry)
190190

191191
if tok.Expiry.IsZero() {
192-
// Token has no expiry — sleep briefly and re-check context.
193-
select {
194-
case <-ctx.Done():
195-
return
196-
case <-time.After(5 * time.Second):
197-
continue
198-
}
192+
// Token has no expiry — treat as valid until context is cancelled.
193+
<-ctx.Done()
194+
195+
return
199196
}
200197

201198
timeUntilExpiry := time.Until(tok.Expiry)

0 commit comments

Comments
 (0)