fix: write msg to redis (#2836)

pull/2842/head
icey-yu 2 months ago committed by GitHub
parent 8d308a4163
commit 3ebd1bbaa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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 (

@ -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
@ -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
}

Loading…
Cancel
Save