Skip to content

Commit 149b531

Browse files
authored
Merge pull request #516 from zendesk/dasch/return-early-when-stopped
Shut down the consumer more quickly
2 parents e15fe17 + 7cc1957 commit 149b531

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/kafka/consumer.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ def join_group
433433
end
434434

435435
def fetch_batches(min_bytes:, max_bytes:, max_wait_time:, automatically_mark_as_processed:)
436+
# Return early if the consumer has been stopped.
437+
return [] if !@running
438+
436439
join_group unless @group.member?
437440

438441
subscribed_partitions = @group.subscribed_partitions

0 commit comments

Comments
 (0)