in case of reload return nil
This commit is contained in:
parent
48b80dd051
commit
1321782785
@ -326,12 +326,16 @@ func (c *registrySelector) run(name string) {
|
||||
func (c *registrySelector) watch(w registry.Watcher) error {
|
||||
defer w.Stop()
|
||||
|
||||
// reload chan
|
||||
reload := make(chan bool, 1)
|
||||
|
||||
// manage this loop
|
||||
go func() {
|
||||
// wait for exit or reload signal
|
||||
select {
|
||||
case <-c.exit:
|
||||
case <-c.reload:
|
||||
reload <- true
|
||||
}
|
||||
|
||||
// stop the watcher
|
||||
@ -341,7 +345,12 @@ func (c *registrySelector) watch(w registry.Watcher) error {
|
||||
for {
|
||||
res, err := w.Next()
|
||||
if err != nil {
|
||||
return err
|
||||
select {
|
||||
case <-reload:
|
||||
return nil
|
||||
default:
|
||||
return err
|
||||
}
|
||||
}
|
||||
c.update(res)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user