Skip to content

Commit 7cc1957

Browse files
committed
Shut down the consumer more quickly
The retry logic would sometimes cause the consumer to be stuck in a fetch loop even when it's supposed to be shutting down.
1 parent e15fe17 commit 7cc1957

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)