mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-16 09:58:33 +02:00
Fix data race (#2721)
This commit is contained in:
parent
9a7cd8ce66
commit
4c34451125
@ -40,6 +40,7 @@ type updateValue struct {
|
||||
}
|
||||
|
||||
type watcher struct {
|
||||
sync.Mutex
|
||||
value reader.Value
|
||||
reader reader.Reader
|
||||
version atomic.Value
|
||||
@ -427,6 +428,9 @@ func (w *watcher) Next() (*loader.Snapshot, error) {
|
||||
}
|
||||
|
||||
func (w *watcher) Stop() error {
|
||||
w.Lock()
|
||||
defer w.Unlock()
|
||||
|
||||
select {
|
||||
case <-w.exit:
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user