mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Don't double-close the channel when etcd returns an error.
This commit is contained in:
parent
a10ac51224
commit
229b8fca2a
@ -105,11 +105,10 @@ func (rm *ReplicationManager) watchControllers() {
|
||||
}()
|
||||
go func() {
|
||||
defer util.HandleCrash()
|
||||
defer func() {
|
||||
close(watchChannel)
|
||||
}()
|
||||
_, err := rm.etcdClient.Watch("/registry/controllers", 0, true, watchChannel, stop)
|
||||
if err != etcd.ErrWatchStoppedByUser {
|
||||
if err == etcd.ErrWatchStoppedByUser {
|
||||
close(watchChannel)
|
||||
} else {
|
||||
glog.Errorf("etcd.Watch stopped unexpectedly: %v (%#v)", err, err)
|
||||
}
|
||||
}()
|
||||
|
@ -135,6 +135,8 @@ func (f *FakeEtcdClient) Watch(prefix string, waitIndex uint64, recursive bool,
|
||||
case <-stop:
|
||||
return nil, etcd.ErrWatchStoppedByUser
|
||||
case err := <-injectedError:
|
||||
// Emulate etcd's behavior.
|
||||
close(receiver)
|
||||
return nil, err
|
||||
}
|
||||
// Never get here.
|
||||
|
Loading…
Reference in New Issue
Block a user