mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-02 17:32: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/openimsdk/tools/utils/timeutil"
|
||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
"math/rand"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -130,6 +132,9 @@ func (c *ConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim s
|
|||||||
c.onlineCache.Cond.Wait()
|
c.onlineCache.Cond.Wait()
|
||||||
}
|
}
|
||||||
c.onlineCache.Lock.Unlock()
|
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() {
|
for msg := range claim.Messages() {
|
||||||
ctx := c.pushConsumerGroup.GetContextFromMsg(msg)
|
ctx := c.pushConsumerGroup.GetContextFromMsg(msg)
|
||||||
c.handleMs2PsChat(ctx, msg.Value)
|
c.handleMs2PsChat(ctx, msg.Value)
|
||||||
|
|||||||
@ -81,10 +81,6 @@ type OnlineCache struct {
|
|||||||
|
|
||||||
func (o *OnlineCache) initUsersOnlineStatus(ctx context.Context) (err error) {
|
func (o *OnlineCache) initUsersOnlineStatus(ctx context.Context) (err error) {
|
||||||
log.ZDebug(ctx, "init users online status begin")
|
log.ZDebug(ctx, "init users online status begin")
|
||||||
defer func() {
|
|
||||||
o.CurrentPhase = DoOnlineStatusOver
|
|
||||||
o.Cond.Broadcast()
|
|
||||||
}()
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
totalSet atomic.Int64
|
totalSet atomic.Int64
|
||||||
@ -96,6 +92,8 @@ func (o *OnlineCache) initUsersOnlineStatus(ctx context.Context) (err error) {
|
|||||||
|
|
||||||
defer func(t time.Time) {
|
defer func(t time.Time) {
|
||||||
log.ZInfo(ctx, "init users online status end", "cost", time.Since(t), "totalSet", totalSet.Load())
|
log.ZInfo(ctx, "init users online status end", "cost", time.Since(t), "totalSet", totalSet.Load())
|
||||||
|
o.CurrentPhase = DoOnlineStatusOver
|
||||||
|
o.Cond.Broadcast()
|
||||||
}(time.Now())
|
}(time.Now())
|
||||||
|
|
||||||
retryOperation := func(operation func() error, operationName string) error {
|
retryOperation := func(operation func() error, operationName string) error {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user