From be8520bc8f45dcec959c94af19938b8dc7f4c0ef Mon Sep 17 00:00:00 2001 From: "fernando.gava" Date: Tue, 17 Dec 2024 15:42:39 -0300 Subject: [PATCH] fix: change Kafka poll to block for 100ms instead of 100ns when no events --- feedback/kafka_consumer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/feedback/kafka_consumer.go b/feedback/kafka_consumer.go index c02cad5..1225512 100644 --- a/feedback/kafka_consumer.go +++ b/feedback/kafka_consumer.go @@ -25,6 +25,7 @@ package feedback import ( "context" "sync" + "time" "github.com/confluentinc/confluent-kafka-go/v2/kafka" "github.com/getsentry/raven-go" @@ -211,7 +212,7 @@ func (q *KafkaConsumer) ConsumeLoop(ctx context.Context) error { l.Info("context done, stopping consuming") return nil default: - message, err := q.Consumer.ReadMessage(100) + message, err := q.Consumer.ReadMessage(100 * time.Millisecond) if message == nil && err.(kafka.Error).IsTimeout() { continue }