From 5da0b95defd9dadf29f50e3bb92cc9aca7d1ad6d Mon Sep 17 00:00:00 2001 From: napallday Date: Sat, 29 Jul 2023 12:52:15 +0800 Subject: [PATCH] fix: avoiding burning cpu if all partitions are paused 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 }