haproxy-consul-connect
haproxy-consul-connect copied to clipboard
MEDIUM: watcher: fix race condition & plumbing stop for test
this fix is related to: https://github.com/haproxytech/haproxy-consul-connect/issues/10
This will not stop the goroutines from running once the Watcher is stopped. One way to do that is to add a check in the infinite loops to stop them when the Watcher is stopped:
for {
select {
case <-w.shutdownCh:
return
default:
}
// work
}
Additionally, I'd prefer exposing a Stop() method rather than the chan directly.
I applied your recommendations.
Please recheck and give a thumbs up for mergeing.