From d20900ccc3509f956860724411ac0222156169ea Mon Sep 17 00:00:00 2001 From: Josh Baker Date: Tue, 17 Apr 2018 08:30:49 -0700 Subject: [PATCH] Fix kafka lockup issue close #293 --- controller/endpoint/kafka.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controller/endpoint/kafka.go b/controller/endpoint/kafka.go index db0b5315..0888da4b 100644 --- a/controller/endpoint/kafka.go +++ b/controller/endpoint/kafka.go @@ -53,7 +53,11 @@ func (conn *KafkaEndpointConn) Send(msg string) error { uri := fmt.Sprintf("%s:%d", conn.ep.Kafka.Host, conn.ep.Kafka.Port) if conn.conn == nil { - c, err := sarama.NewSyncProducer([]string{uri}, nil) + cfg := sarama.NewConfig() + cfg.Net.DialTimeout = time.Second + cfg.Net.ReadTimeout = time.Second * 5 + cfg.Net.WriteTimeout = time.Second * 5 + c, err := sarama.NewSyncProducer([]string{uri}, cfg) if err != nil { return err }