Browse Source

feat:关闭链接

wangchuanjin 3 years ago
parent
commit
07f401baab
1 changed files with 1 additions and 0 deletions
  1. 1 0
      etcd/etcd.go

+ 1 - 0
etcd/etcd.go

@@ -59,6 +59,7 @@ func (e *etcd) Get(key string) ([]string, error) {
 	if err != nil {
 		return nil, err
 	}
+	defer client.Close()
 	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
 	resp, err := client.Get(ctx, key, clientv3.WithPrefix())
 	cancel()