Skip to content

Commit

Permalink
Fix data race (#2721)
Browse files Browse the repository at this point in the history
  • Loading branch information
asim authored Jul 12, 2024
1 parent 9a7cd8c commit 4c34451
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/loader/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type updateValue struct {
}

type watcher struct {
sync.Mutex
value reader.Value
reader reader.Reader
version atomic.Value
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4c34451

Please sign in to comment.