From edb122ca2f0f82f9bbd38c1bc0743f2714f86399 Mon Sep 17 00:00:00 2001 From: Jonathan Fung Date: Wed, 5 Jun 2024 22:56:17 -0400 Subject: [PATCH] stop properly --- protocol/app/app.go | 3 +++ protocol/streaming/grpc/grpc_streaming_manager.go | 1 - protocol/streaming/grpc/noop_streaming_manager.go | 3 +++ protocol/streaming/grpc/types/manager.go | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/protocol/app/app.go b/protocol/app/app.go index 9ecc1399bc..69ec1704e7 100644 --- a/protocol/app/app.go +++ b/protocol/app/app.go @@ -458,6 +458,9 @@ func New( if app.SlinkyClient != nil { app.SlinkyClient.Stop() } + if app.GrpcStreamingManager != nil { + app.GrpcStreamingManager.Stop() + } return nil }, ) diff --git a/protocol/streaming/grpc/grpc_streaming_manager.go b/protocol/streaming/grpc/grpc_streaming_manager.go index 25a009f5c8..f976274c71 100644 --- a/protocol/streaming/grpc/grpc_streaming_manager.go +++ b/protocol/streaming/grpc/grpc_streaming_manager.go @@ -72,7 +72,6 @@ func NewGrpcStreamingManager( for { select { case <-grpcStreamingManager.ticker.C: - // fix this with values grpcStreamingManager.FlushStreamUpdates() case <-grpcStreamingManager.done: return diff --git a/protocol/streaming/grpc/noop_streaming_manager.go b/protocol/streaming/grpc/noop_streaming_manager.go index 424871b4c3..c117a48058 100644 --- a/protocol/streaming/grpc/noop_streaming_manager.go +++ b/protocol/streaming/grpc/noop_streaming_manager.go @@ -46,3 +46,6 @@ func (sm *NoopGrpcStreamingManager) SendOrderbookFillUpdates( func (sm *NoopGrpcStreamingManager) GetUninitializedClobPairIds() []uint32 { return []uint32{} } + +func (sm *NoopGrpcStreamingManager) Stop() { +} diff --git a/protocol/streaming/grpc/types/manager.go b/protocol/streaming/grpc/types/manager.go index 9b5af0c093..3a14f201a2 100644 --- a/protocol/streaming/grpc/types/manager.go +++ b/protocol/streaming/grpc/types/manager.go @@ -7,7 +7,7 @@ import ( type GrpcStreamingManager interface { Enabled() bool - + Stop() // L3+ Orderbook updates. Subscribe( req clobtypes.StreamOrderbookUpdatesRequest,