mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-01 08:52:11 +08:00
fix: add logs
This commit is contained in:
parent
a51b088982
commit
d4fc77b556
@ -40,6 +40,8 @@ import (
|
||||
"github.com/openimsdk/tools/utils/timeutil"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -130,6 +132,9 @@ func (c *ConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim s
|
||||
c.onlineCache.Cond.Wait()
|
||||
}
|
||||
c.onlineCache.Lock.Unlock()
|
||||
ctx := mcontext.SetOperationID(context.TODO(), strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10))
|
||||
log.ZInfo(ctx, "begin consume messages")
|
||||
|
||||
for msg := range claim.Messages() {
|
||||
ctx := c.pushConsumerGroup.GetContextFromMsg(msg)
|
||||
c.handleMs2PsChat(ctx, msg.Value)
|
||||
|
||||
@ -81,10 +81,6 @@ type OnlineCache struct {
|
||||
|
||||
func (o *OnlineCache) initUsersOnlineStatus(ctx context.Context) (err error) {
|
||||
log.ZDebug(ctx, "init users online status begin")
|
||||
defer func() {
|
||||
o.CurrentPhase = DoOnlineStatusOver
|
||||
o.Cond.Broadcast()
|
||||
}()
|
||||
|
||||
var (
|
||||
totalSet atomic.Int64
|
||||
@ -96,6 +92,8 @@ func (o *OnlineCache) initUsersOnlineStatus(ctx context.Context) (err error) {
|
||||
|
||||
defer func(t time.Time) {
|
||||
log.ZInfo(ctx, "init users online status end", "cost", time.Since(t), "totalSet", totalSet.Load())
|
||||
o.CurrentPhase = DoOnlineStatusOver
|
||||
o.Cond.Broadcast()
|
||||
}(time.Now())
|
||||
|
||||
retryOperation := func(operation func() error, operationName string) error {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user