From 40dacea26f44f0ebaab2e4a4d6f5167e12ae1c62 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 29 Feb 2024 15:47:02 +0000 Subject: [PATCH] Set read/write/metadata timeouts to the provider configured timeout --- kafka/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kafka/config.go b/kafka/config.go index 7f1e77b7..5cee0ced 100644 --- a/kafka/config.go +++ b/kafka/config.go @@ -115,6 +115,10 @@ func (c *Config) newKafkaConfig() (*sarama.Config, error) { kafkaConfig.Net.Proxy.Enable = true kafkaConfig.Net.Proxy.Dialer = proxy.FromEnvironment() + kafkaConfig.Net.ReadTimeout = time.Duration(c.Timeout) * time.Second + kafkaConfig.Net.WriteTimeout = time.Duration(c.Timeout) * time.Second + kafkaConfig.Metadata.Timeout = time.Duration(c.Timeout) * time.Second + if c.saslEnabled() { switch c.SASLMechanism { case "scram-sha512":