From b36ddda6ed5adf965852d5227a81c531aa938231 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Thu, 25 Jul 2024 16:30:28 +0100 Subject: [PATCH] chore_: fix defer logs --- protocol/messenger.go | 9 ++++++++- protocol/transport/transport.go | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/protocol/messenger.go b/protocol/messenger.go index 17b034e29..8def9fd3f 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -3445,8 +3445,9 @@ func (m *Messenger) SyncVerificationRequest(ctx context.Context, vr *verificatio // MessengerResponse to the client func (m *Messenger) RetrieveAll() (*MessengerResponse, error) { m.logger.Debug("RetrieveAll start") + defer m.logger.Debug("RetrieveAll end") + chatWithMessages, err := m.transport.RetrieveRawAll() - m.logger.Debug("RetrieveAll end", zap.Any("chatWithMessages", chatWithMessages)) if err != nil { return nil, err } @@ -3900,7 +3901,13 @@ func (m *Messenger) handleImportedMessages(messagesToHandle map[transport.Filter return nil } +var handleRetrievedMessagesCounter = atomic.NewInt32(0) + func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filter][]*types.Message, storeWakuMessages bool, fromArchive bool) (*MessengerResponse, error) { + counter := handleRetrievedMessagesCounter.Inc() + + m.logger.Debug("handleRetrievedMessages start", zap.Int32("counter", counter)) + defer m.logger.Debug("handleRetrievedMessages end", zap.Int32("counter", counter)) m.handleMessagesMutex.Lock() defer m.handleMessagesMutex.Unlock() diff --git a/protocol/transport/transport.go b/protocol/transport/transport.go index bb44f0f32..551503d8e 100644 --- a/protocol/transport/transport.go +++ b/protocol/transport/transport.go @@ -17,6 +17,7 @@ import ( "golang.org/x/exp/maps" "github.com/ethereum/go-ethereum/common" + "github.com/status-im/status-go/connection" "github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/types" @@ -223,6 +224,9 @@ func (t *Transport) GetStats() types.StatsSummary { } func (t *Transport) RetrieveRawAll() (map[Filter][]*types.Message, error) { + t.logger.Debug("RetrieveRawAll start") + defer t.logger.Debug("RetrieveRawAll end") + result := make(map[Filter][]*types.Message) logger := t.logger.With(zap.String("site", "retrieveRawAll"))