Skip to content

Commit

Permalink
update error check to check context is done before panicing for eror
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Koehler committed Oct 20, 2024
1 parent b119432 commit 0ac59f1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/redisstreams/streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ func (s *StreamListener) Listen() {
Count: 1,
}).Result()
if err != nil {

if errors.Is(err, context.Canceled) {
return
}

//select to check for ending satement
select {
case <-s.Ctx.Done():
return
default:
}

s.Logger(s.Ctx).Panic("failed to read data from stream", err, slog.String("streamlistener.stream", s.Key))
}

Expand Down

0 comments on commit 0ac59f1

Please sign in to comment.