Skip to content

Commit

Permalink
Abort from backoff sleep period in redis subscription.
Browse files Browse the repository at this point in the history
  • Loading branch information
lthibault committed Aug 8, 2023
1 parent 7b5d4c0 commit 48b9796
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion stream/transport/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ func (s Subscription) Next(ctx context.Context) (transport.Message, error) {
WithField("attempt", b.Attempt()).
WithField("backoff", b.ForAttempt(b.Attempt())).
Warn("failed to get subscription message from redis")
time.Sleep(b.Duration())
select {
case <-time.After(b.Duration()):
case <-ctx.Done():
return transport.Message{}, ctx.Err()
}

continue
}

Expand Down

0 comments on commit 48b9796

Please sign in to comment.