From aa72f599422b3cbe992e31c423d6ec3d84201d14 Mon Sep 17 00:00:00 2001 From: nap_all_day <44193366+napallday@users.noreply.github.com> Date: Sat, 29 Jul 2023 19:38:22 +0800 Subject: [PATCH] fix: avoiding burning cpu if all partitions are paused (#2532) Signed-off-by: napallday --- consumer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/consumer.go b/consumer.go index 4d08b3dda..11f9896fb 100644 --- a/consumer.go +++ b/consumer.go @@ -920,7 +920,7 @@ func (bc *brokerConsumer) subscriptionManager() { } // subscriptionConsumer ensures we will get nil right away if no new subscriptions is available -// this is a the main loop that fetches Kafka messages +// this is the main loop that fetches Kafka messages func (bc *brokerConsumer) subscriptionConsumer() { for newSubscriptions := range bc.newSubscriptions { bc.updateSubscriptions(newSubscriptions) @@ -942,6 +942,7 @@ func (bc *brokerConsumer) subscriptionConsumer() { // if there isn't response, it means that not fetch was made // so we don't need to handle any response if response == nil { + time.Sleep(partitionConsumersBatchTimeout) continue }