From e8f234d5c7e0670a73a57e66c0e37f1ca2e86d89 Mon Sep 17 00:00:00 2001 From: Gurjot Date: Fri, 10 Jan 2025 12:24:13 +0530 Subject: [PATCH] add more logs --- internal/services/pollers.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/services/pollers.go b/internal/services/pollers.go index 016236c..218f4e4 100644 --- a/internal/services/pollers.go +++ b/internal/services/pollers.go @@ -14,11 +14,13 @@ func (s *Service) processBTCSubscriber(ctx context.Context) *types.Error { var ( lastProcessedID string batchSize = s.cfg.Pollers.ExpiryChecker.BatchSize - totalProcessed = 0 + totalFetched = 0 + batchCount = 0 ) startTime := time.Now() for { + batchCount++ result, err := s.db.GetBTCDelegationsByStatesInBatches( ctx, []types.DelegationState{ @@ -37,6 +39,8 @@ func (s *Service) processBTCSubscriber(ctx context.Context) *types.Error { break } + totalFetched += len(result.Delegations) + // Process batch for _, delegation := range result.Delegations { if s.trackedSubs.IsSubscribed(delegation.StakingTxHashHex) { @@ -57,8 +61,6 @@ func (s *Service) processBTCSubscriber(ctx context.Context) *types.Error { } s.trackedSubs.AddSubscription(delegation.StakingTxHashHex) - totalProcessed++ - log.Debug(). Str("stakingTxHash", delegation.StakingTxHashHex). Msg("Successfully registered BTC notification") @@ -73,7 +75,9 @@ func (s *Service) processBTCSubscriber(ctx context.Context) *types.Error { } log.Info(). - Int("total_processed", totalProcessed). + Int("total_delegations_fetched", totalFetched). + Int("total_batches", batchCount). + Int("batch_size", int(batchSize)). Float64("duration_seconds", time.Since(startTime).Seconds()). Msg("BTC subscription processing completed")