From 9e596df7c9c82af21d0e0246c2d1e6d7fd8fb102 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin <114929630+mtsitrin@users.noreply.github.com> Date: Sun, 1 Oct 2023 10:29:23 +0300 Subject: [PATCH] chore: added missing return statement when subscription cancled (#491) --- block/synctarget.go | 3 ++- settlement/base.go | 2 +- utils/events.go | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/block/synctarget.go b/block/synctarget.go index dfccf3fd5..a7f81b457 100644 --- a/block/synctarget.go +++ b/block/synctarget.go @@ -41,7 +41,8 @@ func (m *Manager) SyncTargetLoop(ctx context.Context) { // TODO(omritoptix): Check if we are the aggregator m.batchInProcess.Store(false) case <-subscription.Cancelled(): - m.logger.Info("Subscription canceled") + m.logger.Info("syncTargetLoop subscription canceled") + return } } } diff --git a/settlement/base.go b/settlement/base.go index b35af7a05..c6dc4b5bc 100644 --- a/settlement/base.go +++ b/settlement/base.go @@ -179,7 +179,7 @@ func (b *BaseLayerClient) stateUpdatesHandler(ready chan bool) { utils.SubmitEventOrPanic(b.ctx, b.pubsub, newBatchEventData, map[string][]string{EventTypeKey: {EventNewBatchAccepted}}) case <-subscription.Cancelled(): - b.logger.Info("subscription canceled") + b.logger.Info("stateUpdatesHandler subscription canceled") return case <-b.ctx.Done(): b.logger.Info("Context done. Exiting state update handler") diff --git a/utils/events.go b/utils/events.go index 2a1953091..89a053173 100644 --- a/utils/events.go +++ b/utils/events.go @@ -22,7 +22,8 @@ func SubscribeAndHandleEvents(ctx context.Context, pubsubServer *pubsub.Server, case event := <-subscription.Out(): callback(event) case <-subscription.Cancelled(): - logger.Info("Subscription canceled") + logger.Info(clientID + " subscription canceled") + return } } }