Skip to content

Commit

Permalink
fix: token parse token value
Browse files Browse the repository at this point in the history
  • Loading branch information
withchao committed Sep 23, 2024
1 parent 25c035d commit bd423ed
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/common/storage/cache/redis/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache"
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey"
"github.com/openimsdk/tools/errs"
"github.com/openimsdk/tools/utils/stringutil"
"github.com/redis/go-redis/v9"
"strconv"
"time"
)

Expand Down Expand Up @@ -58,9 +58,12 @@ func (c *tokenCache) GetTokensWithoutError(ctx context.Context, userID string, p
}
mm := make(map[string]int)
for k, v := range m {
mm[k] = stringutil.StringToInt(v)
state, err := strconv.Atoi(v)
if err != nil {
return nil, errs.WrapMsg(err, "redis token value is not int", "value", v, "userID", userID, "platformID", platformID)
}
mm[k] = state
}

return mm, nil
}

Expand Down

0 comments on commit bd423ed

Please sign in to comment.