mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Close additional leaked GPRC clients
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
parent
1f7abe5dbb
commit
078da46532
@ -28,9 +28,13 @@ func Register(ctx context.Context, runtime *config.ControlRuntime, endpoints con
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
h.etcdClient = cl
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
h.etcdClient.Close()
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -148,6 +148,11 @@ func (e *ETCD) SetControlConfig(ctx context.Context, config *config.Control) err
|
||||
}
|
||||
e.client = client
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
e.client.Close()
|
||||
}()
|
||||
|
||||
address, err := GetAdvertiseAddress(config.PrivateIP)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -479,6 +484,11 @@ func (e *ETCD) Register(ctx context.Context, config *config.Control, handler htt
|
||||
}
|
||||
e.client = client
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
e.client.Close()
|
||||
}()
|
||||
|
||||
address, err := GetAdvertiseAddress(config.PrivateIP)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -1098,6 +1108,11 @@ func (e *ETCD) preSnapshotSetup(ctx context.Context, config *config.Control) err
|
||||
return err
|
||||
}
|
||||
e.client = client
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
e.client.Close()
|
||||
}()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -1958,6 +1973,8 @@ func GetAPIServerURLsFromETCD(ctx context.Context, cfg *config.Control) ([]strin
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer cl.Close()
|
||||
|
||||
etcdResp, err := cl.KV.Get(ctx, AddressKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user