Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode

test-errcode
wangchuxiao 2 years ago
commit 6035bd5683

@ -2,7 +2,11 @@ package msgtransfer
import (
"context"
"fmt"
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"runtime/debug"
"strconv"
"strings"
"sync"
"time"
@ -155,6 +159,7 @@ func (och *OnlineHistoryRedisConsumerHandler) handleNotification(ctx context.Con
}
func (och *OnlineHistoryRedisConsumerHandler) toPushTopic(ctx context.Context, conversationID string, msgs []*sdkws.MsgData) {
fmt.Printf("toPushTopic Stack:\n%s\n", debug.Stack())
for _, v := range msgs {
och.msgDatabase.MsgToPushMQ(ctx, conversationID, v)
}
@ -219,6 +224,11 @@ func (och *OnlineHistoryRedisConsumerHandler) MessagesDistributionHandle() {
log.ZError(ctx, "msg_transfer Unmarshal msg err", err, string(consumerMessages[i].Value))
return
}
var arr []string
for i, header := range consumerMessages[i].Headers {
arr = append(arr, strconv.Itoa(i), string(header.Key), string(header.Value))
}
log.ZInfo(ctx, "consumer.kafka.GetContextWithMQHeader", "len", len(consumerMessages[i].Headers), "header", strings.Join(arr, ", "))
ctxMsg.ctx = kafka.GetContextWithMQHeader(consumerMessages[i].Headers)
ctxMsg.message = &msgFromMQ
log.ZDebug(ctx, "single msg come to distribution center", msgFromMQ.String(), string(consumerMessages[i].Key))

@ -2,10 +2,9 @@ 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"
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"gorm.io/gorm"
)
@ -49,14 +48,14 @@ func (b *blackDatabase) FindOwnerBlacks(ctx context.Context, ownerUserID string,
func (b *blackDatabase) CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error) {
_, err = b.black.Take(ctx, userID1, userID2)
if err != nil {
if errors.Unwrap(err) != gorm.ErrRecordNotFound {
if errs.Unwrap(err) != gorm.ErrRecordNotFound {
return
}
}
inUser1Blacks = err == nil
_, err = b.black.Take(ctx, userID2, userID1)
if err != nil {
if utils.Unwrap(err) != gorm.ErrRecordNotFound {
if errs.Unwrap(err) != gorm.ErrRecordNotFound {
return
}
}

@ -3,6 +3,8 @@ package kafka
import (
"context"
"errors"
"strconv"
"strings"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
@ -87,6 +89,11 @@ func (p *Producer) SendMessage(ctx context.Context, key string, m proto.Message)
if err != nil {
return 0, 0, utils.Wrap(err, "")
}
var arr []string
for i, header := range header {
arr = append(arr, strconv.Itoa(i), string(header.Key), string(header.Value))
}
log.ZInfo(ctx, "producer.kafka.GetContextWithMQHeader", "len", len(header), "header", strings.Join(arr, ", "))
kMsg.Headers = header
partition, offset, err := p.producer.SendMessage(kMsg)
log.ZDebug(ctx, "ByteEncoder SendMessage end", "key ", kMsg.Key, "key length", kMsg.Value.Length())

Loading…
Cancel
Save