mirror of https://github.com/harness/drone.git
[Pubsub] handle closed redis channel (#800)
parent
07951e7d7e
commit
0793af5f9f
|
@ -142,7 +142,11 @@ func (s *redisSubscriber) start(ctx context.Context) {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
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 {
|
if err := s.handler([]byte(msg.Payload)); err != nil {
|
||||||
log.Ctx(ctx).Err(err).Msg("received an error from handler function")
|
log.Ctx(ctx).Err(err).Msg("received an error from handler function")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue