From 4381b181bdfb5c303972c75e465417a8fe8ad299 Mon Sep 17 00:00:00 2001 From: Martin Schneppenheim <23424570+weeco@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:25:36 +0000 Subject: [PATCH] limit metadata max age to 1s --- kafka/client_config_helper.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kafka/client_config_helper.go b/kafka/client_config_helper.go index 12d71be..ad34075 100644 --- a/kafka/client_config_helper.go +++ b/kafka/client_config_helper.go @@ -34,6 +34,9 @@ func NewKgoConfig(cfg Config, logger *zap.Logger) ([]kgo.Opt, error) { kgo.ClientID(cfg.ClientID), kgo.FetchMaxBytes(5 * 1000 * 1000), // 5MB kgo.MaxConcurrentFetches(10), + // Limit metadata age to mitigate issues with unknown partition/topic + // requests shortly after the creation or changing the partitions. + kgo.MetadataMaxAge(time.Second), } // Create Logger