Skip to content

Commit 0ac59f1

Browse files
author
Jeffrey Koehler
committed
update error check to check context is done before panicing for eror
1 parent b119432 commit 0ac59f1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/redisstreams/streams.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,18 @@ func (s *StreamListener) Listen() {
3434
Count: 1,
3535
}).Result()
3636
if err != nil {
37+
3738
if errors.Is(err, context.Canceled) {
3839
return
3940
}
41+
42+
//select to check for ending satement
43+
select {
44+
case <-s.Ctx.Done():
45+
return
46+
default:
47+
}
48+
4049
s.Logger(s.Ctx).Panic("failed to read data from stream", err, slog.String("streamlistener.stream", s.Key))
4150
}
4251

0 commit comments

Comments
 (0)