|
|
|
@ -22,6 +22,7 @@ import (
|
|
|
|
|
func (d *DataBases) NewSetMessageToCache(msgList []*pbChat.MsgDataToMQ, uid string, operationID string) error {
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
var failedList []pbChat.MsgDataToMQ
|
|
|
|
|
var err error
|
|
|
|
|
for _, msg := range msgList {
|
|
|
|
|
key := messageCache + uid + "_" + strconv.Itoa(int(msg.MsgData.Seq))
|
|
|
|
|
s, err := utils.Pb2Map(msg.MsgData)
|
|
|
|
@ -38,7 +39,7 @@ func (d *DataBases) NewSetMessageToCache(msgList []*pbChat.MsgDataToMQ, uid stri
|
|
|
|
|
d.rdb.Expire(ctx, key, time.Second*time.Duration(config.Config.MsgCacheTimeout))
|
|
|
|
|
}
|
|
|
|
|
if len(failedList) != 0 {
|
|
|
|
|
return errors.New(fmt.Sprintf("set msg to cache failed, failed lists: %q,%s", failedList, operationID))
|
|
|
|
|
return errors.New(fmt.Sprintf("set msg to cache failed, failed lists: %q,%s", failedList, operationID) + err.Error())
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|