Simmplified RT Lookup. No more Metric in Query.

This commit is contained in:
Milos Gajdos
2019-07-01 20:33:08 +01:00
parent d3e200575c
commit da299ea26b
3 changed files with 47 additions and 56 deletions

View File

@@ -232,7 +232,11 @@ func (r *router) watchError(errChan <-chan error) {
// stop the router if some error happened
if err != nil && code != Stopped {
// this will stop watchers which will close r.advertChan
close(r.exit)
// drain the advertise channel
for range r.advertChan {
}
}
}
@@ -343,13 +347,12 @@ func (r *router) Stop() error {
if r.status.Code == Running {
// notify all goroutines to finish
close(r.exit)
// drain the advertise channel
for range r.advertChan {
}
}
r.RUnlock()
// drain the advertise channel
for range r.advertChan {
}
// wait for all goroutines to finish
r.wg.Wait()