Commit e750ee50 authored by Brad Davidson's avatar Brad Davidson Committed by Brad Davidson

Close additional leaked GPRC clients

parent e0327046
......@@ -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
}
......
......@@ -146,6 +146,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
......@@ -473,6 +478,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
......@@ -1034,6 +1044,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
}
......@@ -1895,6 +1910,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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment