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:
Igor Šćekić
2026-02-02 14:51:03 +01:00
parent 18934825aa
commit 6834fe4380
@@ -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 () => {