From 0793af5f9feeef970e90464bcc1dc6109112a728 Mon Sep 17 00:00:00 2001 From: Johannes Batzill Date: Wed, 15 Nov 2023 00:04:34 +0000 Subject: [PATCH] [Pubsub] handle closed redis channel (#800) --- pubsub/redis.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pubsub/redis.go b/pubsub/redis.go index 581664823..3ddca4f15 100644 --- a/pubsub/redis.go +++ b/pubsub/redis.go @@ -142,7 +142,11 @@ func (s *redisSubscriber) start(ctx context.Context) { select { case <-ctx.Done(): return - case msg := <-ch: + case msg, ok := <-ch: + if !ok { + log.Ctx(ctx).Debug().Msg("redis channel was closed") + return + } if err := s.handler([]byte(msg.Payload)); err != nil { log.Ctx(ctx).Err(err).Msg("received an error from handler function") }