Fix kafka lockup issue

close #293
This commit is contained in:
Josh Baker 2018-04-17 08:30:49 -07:00
parent fc8d3a2c67
commit d20900ccc3
1 changed files with 5 additions and 1 deletions

View File

@ -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
}