Skip to content

Commit

Permalink
Fix data race
Browse files Browse the repository at this point in the history
  • Loading branch information
asim committed Jul 12, 2024
1 parent 9a7cd8c commit e945405
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 e945405

Please sign in to comment.