message update

pull/351/head
Gordon 2 years ago
parent cdf851d196
commit 5c503e71ed

@ -61,9 +61,9 @@ func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.Pull
msgList, err1 := commonDB.DB.GetMsgBySeqListMongo2(in.UserID, failedSeqList, in.OperationID) msgList, err1 := commonDB.DB.GetMsgBySeqListMongo2(in.UserID, failedSeqList, in.OperationID)
if err1 != nil { if err1 != nil {
promePkg.PromeAdd(promePkg.MsgPullFromMongoFailedCounter, len(failedSeqList)) promePkg.PromeAdd(promePkg.MsgPullFromMongoFailedCounter, len(failedSeqList))
log.Error(in.OperationID, "PullMessageBySeqList data error", in.String(), err.Error()) log.Error(in.OperationID, "PullMessageBySeqList data error", in.String(), err1.Error())
resp.ErrCode = 201 resp.ErrCode = 201
resp.ErrMsg = err.Error() resp.ErrMsg = err1.Error()
return resp, nil return resp, nil
} else { } else {
promePkg.PromeAdd(promePkg.MsgPullFromMongoSuccessCounter, len(msgList)) promePkg.PromeAdd(promePkg.MsgPullFromMongoSuccessCounter, len(msgList))
@ -88,9 +88,9 @@ func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.Pull
msgList, err1 := commonDB.DB.GetSuperGroupMsgBySeqListMongo(k, failedSeqList, in.OperationID) msgList, err1 := commonDB.DB.GetSuperGroupMsgBySeqListMongo(k, failedSeqList, in.OperationID)
if err1 != nil { if err1 != nil {
promePkg.PromeAdd(promePkg.MsgPullFromMongoFailedCounter, len(failedSeqList)) promePkg.PromeAdd(promePkg.MsgPullFromMongoFailedCounter, len(failedSeqList))
log.Error(in.OperationID, "PullMessageBySeqList data error", in.String(), err.Error()) log.Error(in.OperationID, "PullMessageBySeqList data error", in.String(), err1.Error())
resp.ErrCode = 201 resp.ErrCode = 201
resp.ErrMsg = err.Error() resp.ErrMsg = err1.Error()
return resp, nil return resp, nil
} else { } else {
promePkg.PromeAdd(promePkg.MsgPullFromMongoSuccessCounter, len(msgList)) promePkg.PromeAdd(promePkg.MsgPullFromMongoSuccessCounter, len(msgList))

@ -374,9 +374,6 @@ func (d *DataBases) GetMsgBySeqListMongo2(uid string, seqList []uint32, operatio
} }
} }
} }
if len(hasSeqList) == 0 {
return nil, errors.New("pull message is null")
}
if len(hasSeqList) != len(seqList) { if len(hasSeqList) != len(seqList) {
var diff []uint32 var diff []uint32
diff = utils.Difference(hasSeqList, seqList) diff = utils.Difference(hasSeqList, seqList)

@ -39,35 +39,3 @@ func (f *fileHook) Fire(entry *logrus.Entry) error {
entry.Data["FilePath"] = s entry.Data["FilePath"] = s
return nil return nil
} }
//func findCaller(skip int) string {
// file := ""
// line := 0
// for i := 0; i < 10; i++ {
// file, line = getCaller(skip + i)
// if !strings.HasPrefix(file, "log") {
// break
// }
// }
// return fmt.Sprintf("%s:%d", file, line)
//}
//
//func getCaller(skip int) (string, int) {
// _, file, line, ok := runtime.Caller(skip)
//
// if !ok {
// return "", 0
// }
// fmt.Println("skip:", skip, "file:", file, "line", line)
// n := 0
// for i := len(file) - 1; i > 0; i-- {
// if file[i] == '/' {
// n++
// if n >= 2 {
// file = file[i+1:]
// break
// }
// }
// }
// return file, line
//}

Loading…
Cancel
Save