From 6aeae4fa815acb40e770e2fd7bdc1884abfbbf9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Mon, 14 Aug 2023 09:43:39 -0500 Subject: [PATCH] ensure lock is obtained when getting values channel --- fsnotify/filewatcher.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fsnotify/filewatcher.go b/fsnotify/filewatcher.go index 5c72681..9af7f41 100644 --- a/fsnotify/filewatcher.go +++ b/fsnotify/filewatcher.go @@ -2,7 +2,6 @@ package fsnotify import ( "context" - rfsnotify "github.com/fsnotify/fsnotify" "io/ioutil" "log" "net/url" @@ -10,6 +9,7 @@ import ( "sync" "time" + rfsnotify "github.com/fsnotify/fsnotify" "github.com/infobloxopen/hotload" ) @@ -98,8 +98,9 @@ func (s *Strategy) setVal(pth string, val string) { s.mu.Lock() defer s.mu.Unlock() s.paths[pth].value = val + values := s.paths[pth].values go func() { - s.paths[pth].values <- val + values <- val }() }