From 6c0922a6d83ac9eb1676185cded2542735746a3a Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 9 Aug 2022 19:44:27 +0800 Subject: [PATCH] fix delete --- pkg/common/db/RedisModel.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/common/db/RedisModel.go b/pkg/common/db/RedisModel.go index f21c61bc1..535acd2e8 100644 --- a/pkg/common/db/RedisModel.go +++ b/pkg/common/db/RedisModel.go @@ -360,7 +360,15 @@ func (d *DataBases) DelUserSignalList(userID string) error { func (d *DataBases) DelMsgFromCache(uid string, seqList []uint32, operationID string) { for _, seq := range seqList { key := messageCache + uid + "_" + strconv.Itoa(int(seq)) - result := d.RDB.Get(context.Background(), key).String() + result, err := d.RDB.Get(context.Background(), key).Result() + if err != nil { + if err == go_redis.Nil { + log2.NewDebug(operationID, utils.GetSelfFuncName(), err.Error(), "redis nil") + } else { + log2.NewError(operationID, utils.GetSelfFuncName(), err.Error(), key) + } + continue + } var msg pbCommon.MsgData if err := utils.String2Pb(result, &msg); err != nil { log2.Error(operationID, utils.GetSelfFuncName(), "String2Pb failed", msg, result, key, err.Error())