From 96baa5a0ffac3d7c4d4727876ffe418ec6be4e3b Mon Sep 17 00:00:00 2001 From: icey-yu <119291641+icey-yu@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:38:27 +0800 Subject: [PATCH 1/2] fix: check error in BatchSetTokenMapByUidPid (#3076) --- pkg/common/storage/controller/auth.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/common/storage/controller/auth.go b/pkg/common/storage/controller/auth.go index 2885b985a..ee2a06f53 100644 --- a/pkg/common/storage/controller/auth.go +++ b/pkg/common/storage/controller/auth.go @@ -60,16 +60,15 @@ func (a *authDatabase) BatchSetTokenMapByUidPid(ctx context.Context, tokens []st setMap := make(map[string]map[string]any) for _, token := range tokens { claims, err := tokenverify.GetClaimFromToken(token, authverify.Secret(a.accessSecret)) - key := cachekey.GetTokenKey(claims.UserID, claims.PlatformID) if err != nil { continue + } + key := cachekey.GetTokenKey(claims.UserID, claims.PlatformID) + if v, ok := setMap[key]; ok { + v[token] = constant.KickedToken } else { - if v, ok := setMap[key]; ok { - v[token] = constant.KickedToken - } else { - setMap[key] = map[string]any{ - token: constant.KickedToken, - } + setMap[key] = map[string]any{ + token: constant.KickedToken, } } } From bbb5473d26a847a4a35b01a3c9d70da16234591d Mon Sep 17 00:00:00 2001 From: chao <48119764+withchao@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:24:40 +0800 Subject: [PATCH 2/2] fix: DeleteDoc crash (#3078) * pb * fix: Modifying other fields while setting IsPrivateChat does not take effect * fix: quote message error revoke * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * upgrading pkg tools * fix * fix * optimize log output * feat: support GetLastMessage * feat: support GetLastMessage * feat: s3 switch * feat: s3 switch * fix: GetUsersOnline * feat: SendBusinessNotification supported configuration parameters * feat: SendBusinessNotification supported configuration parameters * feat: SendBusinessNotification supported configuration parameters * feat: seq conversion failed without exiting * fix: DeleteDoc crash --- pkg/common/storage/controller/msg.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/common/storage/controller/msg.go b/pkg/common/storage/controller/msg.go index a93d581eb..b92f9b510 100644 --- a/pkg/common/storage/controller/msg.go +++ b/pkg/common/storage/controller/msg.go @@ -18,11 +18,12 @@ import ( "context" "encoding/json" "errors" - "github.com/openimsdk/tools/utils/jsonutil" "strconv" "strings" "time" + "github.com/openimsdk/tools/utils/jsonutil" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" @@ -722,13 +723,13 @@ func (db *commonMsgDatabase) DeleteDoc(ctx context.Context, docID string) error if index <= 0 { return errs.ErrInternalServer.WrapMsg("docID is invalid", "docID", docID) } - index, err := strconv.Atoi(docID[index+1:]) + docIndex, err := strconv.Atoi(docID[index+1:]) if err != nil { return errs.WrapMsg(err, "strconv.Atoi", "docID", docID) } conversationID := docID[:index] seqs := make([]int64, db.msgTable.GetSingleGocMsgNum()) - minSeq := db.msgTable.GetMinSeq(index) + minSeq := db.msgTable.GetMinSeq(docIndex) for i := range seqs { seqs[i] = minSeq + int64(i) }