From 7abe7ed3abda7ad21e889a8d2078b93c6dbf8592 Mon Sep 17 00:00:00 2001
From: Jonathan Fung <jonathan@dydx.exchange>
Date: Thu, 8 Aug 2024 18:06:50 -0700
Subject: [PATCH] debug logs

---
 protocol/streaming/full_node_streaming_manager.go | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go
index fb10dfb3ecf..5c51dea5c76 100644
--- a/protocol/streaming/full_node_streaming_manager.go
+++ b/protocol/streaming/full_node_streaming_manager.go
@@ -206,6 +206,9 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe(
 func (sm *FullNodeStreamingManagerImpl) removeSubscription(
 	subscriptionIdToRemove uint32,
 ) {
+	sm.logger.Info(
+		fmt.Sprintf("starting to remove subscription %+v", subscriptionIdToRemove),
+	)
 	subscription := sm.orderbookSubscriptions[subscriptionIdToRemove]
 	if subscription == nil {
 		return
@@ -486,6 +489,9 @@ func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdatesWithLock() {
 			subscriptionUpdates[id] = append(subscriptionUpdates[id], update)
 		}
 	}
+	sm.logger.Info(
+		fmt.Sprintf("flushing updates of length %+v", len(sm.streamUpdateCache)),
+	)
 
 	// Non-blocking send updates through subscriber's buffered channel.
 	// If the buffer is full, drop the subscription.
@@ -497,7 +503,9 @@ func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdatesWithLock() {
 			)
 			select {
 			case subscription.updatesChannel <- updates:
+				sm.logger.Info(fmt.Sprintf("emitting update through channel now len %+v", len(subscription.updatesChannel)))
 			default:
+				sm.logger.Info(fmt.Sprintf("buffer full removing id %+v", id))
 				idsToRemove = append(idsToRemove, id)
 			}
 		}