mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-10 03:56:00 +08:00
Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode
This commit is contained in:
@@ -3,7 +3,6 @@ package controller
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
@@ -53,22 +52,16 @@ func (b *blackDatabase) CheckIn(ctx context.Context, userID1, userID2 string) (i
|
||||
if errors.Unwrap(err) != gorm.ErrRecordNotFound {
|
||||
return
|
||||
}
|
||||
inUser1Blacks = false
|
||||
} else {
|
||||
inUser1Blacks = true
|
||||
}
|
||||
|
||||
inUser2Blacks = true
|
||||
inUser1Blacks = err == nil
|
||||
_, err = b.black.Take(ctx, userID2, userID1)
|
||||
if err != nil {
|
||||
if utils.Unwrap(err) != gorm.ErrRecordNotFound {
|
||||
return
|
||||
}
|
||||
inUser2Blacks = false
|
||||
} else {
|
||||
inUser2Blacks = true
|
||||
}
|
||||
return
|
||||
inUser2Blacks = err == nil
|
||||
return inUser1Blacks, inUser2Blacks, nil
|
||||
}
|
||||
|
||||
func (b *blackDatabase) FindBlackIDs(ctx context.Context, ownerUserID string) (blackIDs []string, err error) {
|
||||
|
||||
@@ -126,8 +126,9 @@ func (db *commonMsgDatabase) MsgToPushMQ(ctx context.Context, conversationID str
|
||||
partition, offset, err := db.producerToPush.SendMessage(ctx, conversationID, &pbMsg.PushMsgDataToMQ{MsgData: msg2mq, ConversationID: conversationID})
|
||||
if err != nil {
|
||||
log.ZError(ctx, "MsgToPushMQ", err, "key", conversationID, "msg2mq", msg2mq)
|
||||
return 0, 0, err
|
||||
}
|
||||
return partition, offset, err
|
||||
return partition, offset, nil
|
||||
}
|
||||
|
||||
func (db *commonMsgDatabase) MsgToMongoMQ(ctx context.Context, conversationID string, messages []*sdkws.MsgData, lastSeq int64) error {
|
||||
@@ -218,7 +219,7 @@ func (db *commonMsgDatabase) DeleteMessageFromCache(ctx context.Context, convers
|
||||
|
||||
func (db *commonMsgDatabase) BatchInsertChat2Cache(ctx context.Context, conversationID string, msgs []*sdkws.MsgData) (seq int64, isNew bool, err error) {
|
||||
currentMaxSeq, err := db.cache.GetMaxSeq(ctx, conversationID)
|
||||
if err != nil && err != redis.Nil {
|
||||
if err != nil && errs.Unwrap(err) != redis.Nil {
|
||||
prome.Inc(prome.SeqGetFailedCounter)
|
||||
return 0, false, err
|
||||
}
|
||||
@@ -230,7 +231,7 @@ func (db *commonMsgDatabase) BatchInsertChat2Cache(ctx context.Context, conversa
|
||||
if lenList < 1 {
|
||||
return 0, false, errors.New("too short as 0")
|
||||
}
|
||||
if err == redis.Nil {
|
||||
if errs.Unwrap(err) == redis.Nil {
|
||||
isNew = true
|
||||
}
|
||||
lastMaxSeq := currentMaxSeq
|
||||
|
||||
Reference in New Issue
Block a user