fix: check error in BatchSetTokenMapByUidPid (#3076)

pull/3197/head
icey-yu 8 months ago committed by withchao
parent d7af353e42
commit efcd76318e

@ -59,16 +59,15 @@ func (a *authDatabase) BatchSetTokenMapByUidPid(ctx context.Context, tokens []st
setMap := make(map[string]map[string]any) setMap := make(map[string]map[string]any)
for _, token := range tokens { for _, token := range tokens {
claims, err := tokenverify.GetClaimFromToken(token, authverify.Secret(a.accessSecret)) claims, err := tokenverify.GetClaimFromToken(token, authverify.Secret(a.accessSecret))
key := cachekey.GetTokenKey(claims.UserID, claims.PlatformID)
if err != nil { if err != nil {
continue continue
}
key := cachekey.GetTokenKey(claims.UserID, claims.PlatformID)
if v, ok := setMap[key]; ok {
v[token] = constant.KickedToken
} else { } else {
if v, ok := setMap[key]; ok { setMap[key] = map[string]any{
v[token] = constant.KickedToken token: constant.KickedToken,
} else {
setMap[key] = map[string]any{
token: constant.KickedToken,
}
} }
} }
} }

Loading…
Cancel
Save