diff --git a/lib/kafka/consumer.rb b/lib/kafka/consumer.rb index 6ddbaf798..d7deb8978 100644 --- a/lib/kafka/consumer.rb +++ b/lib/kafka/consumer.rb @@ -116,7 +116,6 @@ def subscribe(topic_or_regex, default_offset: nil, start_from_beginning: true, m def stop @running = false @fetcher.stop - @cluster.disconnect end # Pause processing of a specific topic partition. @@ -433,6 +432,7 @@ def consumer_loop # important that members explicitly tell Kafka when they're leaving. make_final_offsets_commit! @group.leave rescue nil + @cluster.disconnect @running = false @logger.pop_tags end