Skip to content

Commit

Permalink
chore: 🍻 增加zk插件timeout配置项的默认值 (#1023)
Browse files Browse the repository at this point in the history
* chore: 🍻 增加zk插件timeout配置项的默认值

* fix: 去掉自动增加的空格
  • Loading branch information
eryajf authored Aug 9, 2024
1 parent c6c5451 commit 0ceded3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions inputs/zookeeper/zookeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package zookeeper
import (
crypto_tls "crypto/tls"
"fmt"
"io/ioutil"
"io"
"log"
"net"
"regexp"
Expand Down Expand Up @@ -91,6 +91,10 @@ func (ins *Instance) Init() error {
if len(ins.ZkHosts()) == 0 {
return types.ErrInstancesEmpty
}
// set default timeout
if ins.Timeout == 0 {
ins.Timeout = 10
}
return nil
}

Expand Down Expand Up @@ -242,7 +246,7 @@ func sendZookeeperCmd(conn net.Conn, cmd string) string {
return ""
}

res, err := ioutil.ReadAll(conn)
res, err := io.ReadAll(conn)
if err != nil {
log.Printf("E! failed read Zookeeper command: '%s' response from '%s': %s", cmd, conn.RemoteAddr().String(), err)
return ""
Expand Down

0 comments on commit 0ceded3

Please sign in to comment.