From a87e4c16cef5df1ec66da0f4135b11a46309f88d Mon Sep 17 00:00:00 2001 From: jayy04 <103467857+jayy04@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:01:58 -0400 Subject: [PATCH] [CT-700] only send response when there is at least one update (#1216) --- .../streaming/grpc/grpc_streaming_manager.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/protocol/streaming/grpc/grpc_streaming_manager.go b/protocol/streaming/grpc/grpc_streaming_manager.go index 8db6daca6b..b4cea80b57 100644 --- a/protocol/streaming/grpc/grpc_streaming_manager.go +++ b/protocol/streaming/grpc/grpc_streaming_manager.go @@ -110,13 +110,15 @@ func (sm *GrpcStreamingManagerImpl) SendOrderbookUpdates( } } - if err := subscription.srv.Send( - &clobtypes.StreamOrderbookUpdatesResponse{ - Updates: updatesToSend, - Snapshot: snapshot, - }, - ); err != nil { - idsToRemove = append(idsToRemove, id) + if len(updatesToSend) > 0 { + if err := subscription.srv.Send( + &clobtypes.StreamOrderbookUpdatesResponse{ + Updates: updatesToSend, + Snapshot: snapshot, + }, + ); err != nil { + idsToRemove = append(idsToRemove, id) + } } }