MCPcopy
hub / github.com/grpc/grpc-go / refreshToken

Method refreshToken

credentials/jwt/token_file_call_creds.go:136–145  ·  view source on GitHub ↗

refreshToken reads the token from file and updates the cached data.

()

Source from the content-addressed store, hash-verified

134
135// refreshToken reads the token from file and updates the cached data.
136func (c *jwtTokenFileCallCreds) refreshToken() {
137 // Deliberately not locking c.mu here. This way other RPCs can proceed
138 // while we read the token. This is per gRFC A97.
139 token, expiry, err := c.fileReader.readToken()
140
141 c.mu.Lock()
142 defer c.mu.Unlock()
143 c.updateCacheLocked(token, expiry, err)
144 c.pendingRefresh = false
145}
146
147// updateCacheLocked updates the cached token, expiry, and error state.
148// If an error is provided, it determines whether to set it as an UNAVAILABLE

Callers 1

GetRequestMetadataMethod · 0.95

Calls 4

updateCacheLockedMethod · 0.95
readTokenMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected