mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fixing two goroutine leaks and one panic
This commit is contained in:
parent
29292aa7bd
commit
0098dbf350
@ -607,7 +607,9 @@ func (c *simpleHTTPClient) Do(ctx context.Context, act httpAction) (*http.Respon
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
resp.Body.Close()
|
if resp != nil {
|
||||||
|
resp.Body.Close()
|
||||||
|
}
|
||||||
<-done
|
<-done
|
||||||
return nil, nil, ctx.Err()
|
return nil, nil, ctx.Err()
|
||||||
case <-done:
|
case <-done:
|
||||||
|
@ -35,6 +35,8 @@ func TestWatch(t *testing.T) {
|
|||||||
s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{})
|
s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{})
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
b.Close()
|
||||||
|
s.Close()
|
||||||
s.store.Close()
|
s.store.Close()
|
||||||
os.Remove(tmpPath)
|
os.Remove(tmpPath)
|
||||||
}()
|
}()
|
||||||
@ -536,6 +538,8 @@ func TestWatchVictims(t *testing.T) {
|
|||||||
s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{})
|
s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{})
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
b.Close()
|
||||||
|
s.Close()
|
||||||
s.store.Close()
|
s.store.Close()
|
||||||
os.Remove(tmpPath)
|
os.Remove(tmpPath)
|
||||||
chanBufLen, maxWatchersPerSync = oldChanBufLen, oldMaxWatchersPerSync
|
chanBufLen, maxWatchersPerSync = oldChanBufLen, oldMaxWatchersPerSync
|
||||||
|
Loading…
x
Reference in New Issue
Block a user