Skip to content

Commit

Permalink
consumer: return from Poll if the only error is an injected fake
Browse files Browse the repository at this point in the history
Poll previously would not return if only a fake fetch existed. For
example, if a user joined a group with an instance ID twice, the fenced
group member would never exit polling. We now check both the actual
ready sources and the fake sources in our poll condition loop.

Closes #479.
  • Loading branch information
twmb committed Jun 27, 2023
1 parent 2008b10 commit 5c87ce0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/kgo/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ func (cl *Client) PollRecords(ctx context.Context, maxPollRecords int) Fetches {
defer c.sourcesReadyMu.Unlock()
defer close(done)

for !quit && len(c.sourcesReadyForDraining) == 0 {
for !quit && len(c.sourcesReadyForDraining) == 0 && len(c.fakeReadyForDraining) == 0 {
c.sourcesReadyCond.Wait()
}
}()
Expand Down

0 comments on commit 5c87ce0

Please sign in to comment.