[Pubsub] handle closed redis channel (#800)

rkapoor10-patch-1
Johannes Batzill 2023-11-15 00:04:34 +00:00 committed by Harness
parent 07951e7d7e
commit 0793af5f9f
1 changed files with 5 additions and 1 deletions

View File

@ -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")
}