Skip to content

Commit

Permalink
fix: avoiding burning cpu if all partitions are paused (#2532)
Browse files Browse the repository at this point in the history
Signed-off-by: napallday <bzx0619@gmail.com>
  • Loading branch information
napallday committed Jul 29, 2023
1 parent 34bc8f9 commit aa72f59
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

Expand Down

0 comments on commit aa72f59

Please sign in to comment.