From 50f211da4f0ff89f011b950a1dfaadcefc75a937 Mon Sep 17 00:00:00 2001 From: ganeshvanahalli Date: Thu, 16 Nov 2023 14:26:22 -0600 Subject: [PATCH] Handle nil channel case inside router model --- broadcastclients/broadcastclients.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/broadcastclients/broadcastclients.go b/broadcastclients/broadcastclients.go index 551dcdb462..b2824221ea 100644 --- a/broadcastclients/broadcastclients.go +++ b/broadcastclients/broadcastclients.go @@ -166,7 +166,9 @@ func (bcs *BroadcastClients) Start(ctx context.Context) { continue } lastConfirmed = cs - bcs.primaryRouter.forwardConfirmationChan <- cs + if bcs.primaryRouter.forwardConfirmationChan != nil { + bcs.primaryRouter.forwardConfirmationChan <- cs + } // Secondary Feeds case msg := <-bcs.secondaryRouter.messageChan: @@ -187,7 +189,9 @@ func (bcs *BroadcastClients) Start(ctx context.Context) { continue } lastConfirmed = cs - bcs.secondaryRouter.forwardConfirmationChan <- cs + if bcs.secondaryRouter.forwardConfirmationChan != nil { + bcs.secondaryRouter.forwardConfirmationChan <- cs + } // Cycle buckets to get rid of old entries case <-recentFeedItemsCleanup.C: