Skip to content

Commit

Permalink
fix: redis err check
Browse files Browse the repository at this point in the history
  • Loading branch information
icey-yu committed Nov 26, 2024
1 parent 181d304 commit 08abd33
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/rpc/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (s *authServer) forceKickOff(ctx context.Context, userID string, platformID
}

m, err := s.authDatabase.GetTokensWithoutError(ctx, userID, int(platformID))
if err != nil && errors.Is(err, redis.Nil) {
if err != nil && !errors.Is(err, redis.Nil) {
return err
}
for k := range m {
Expand All @@ -214,7 +214,7 @@ func (s *authServer) forceKickOff(ctx context.Context, userID string, platformID

func (s *authServer) InvalidateToken(ctx context.Context, req *pbauth.InvalidateTokenReq) (*pbauth.InvalidateTokenResp, error) {
m, err := s.authDatabase.GetTokensWithoutError(ctx, req.UserID, int(req.PlatformID))
if err != nil && errors.Is(err, redis.Nil) {
if err != nil && !errors.Is(err, redis.Nil) {
return nil, err
}
if m == nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/rpc/msg/as_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon
return nil, err
}
hasReadSeq, err := m.MsgDatabase.GetHasReadSeq(ctx, req.UserID, req.ConversationID)
if err != nil && errors.Is(err, redis.Nil) {
if err != nil && !errors.Is(err, redis.Nil) {
return nil, err
}
var seqs []int64
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/storage/controller/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func (db *commonMsgDatabase) GetMsgBySeqs(ctx context.Context, userID string, co
}
successMsgs, failedSeqs, err := db.msg.GetMessagesBySeq(ctx, conversationID, newSeqs)
if err != nil {
if errors.Is(err, redis.Nil) {
if !errors.Is(err, redis.Nil) {
log.ZError(ctx, "get message from redis exception", err, "failedSeqs", failedSeqs, "conversationID", conversationID)
}
}
Expand Down

0 comments on commit 08abd33

Please sign in to comment.