fix(kilo-sessions): clear auth validity cache on token change
Ensure in-flight auth validity lookups are not reused across different tokens by clearing the previous cache key when a new token is received.
This commit is contained in:
@@ -29,6 +29,12 @@ export namespace KiloSessions {
|
||||
}
|
||||
|
||||
async function authValid(token: string) {
|
||||
const newTokenValidKey = tokenValidKeyTemplate + token
|
||||
|
||||
if (newTokenValidKey !== tokenValidKey) {
|
||||
clearInFlightCache(tokenValidKey)
|
||||
}
|
||||
|
||||
tokenValidKey = tokenValidKeyTemplate + token
|
||||
|
||||
return withInFlightCache(tokenValidKey, Number.POSITIVE_INFINITY, async () => {
|
||||
|
||||
Reference in New Issue
Block a user