Skip to content

Commit

Permalink
fix: write msg to redis (openimsdk#2836)
Browse files Browse the repository at this point in the history
  • Loading branch information
icey-yu authored Nov 5, 2024
1 parent 8d308a4 commit 3ebd1bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
14 changes: 0 additions & 14 deletions pkg/common/storage/cache/redis/msg.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
// Copyright © 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package redis

import (
Expand Down
10 changes: 10 additions & 0 deletions pkg/common/storage/controller/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ func (db *commonMsgDatabase) GetMsgBySeqsRange(ctx context.Context, userID strin
return 0, 0, nil, err
}
successMsgs = append(mongoMsgs, successMsgs...)

_, err = db.msg.SetMessagesToCache(ctx, conversationID, mongoMsgs)
if err != nil {
return 0, 0, nil, err
}
}

return minSeq, maxSeq, successMsgs, nil
Expand Down Expand Up @@ -500,6 +505,11 @@ func (db *commonMsgDatabase) GetMsgBySeqs(ctx context.Context, userID string, co
}

successMsgs = append(successMsgs, mongoMsgs...)

_, err = db.msg.SetMessagesToCache(ctx, conversationID, mongoMsgs)
if err != nil {
return 0, 0, nil, err
}
}
return minSeq, maxSeq, successMsgs, nil
}
Expand Down

0 comments on commit 3ebd1bb

Please sign in to comment.