mirror of
https://github.com/glanceapp/glance.git
synced 2025-02-23 22:01:09 +01:00
Even more config watcher fixes
This commit is contained in:
parent
1785af4749
commit
ffe053ffc5
@ -172,11 +172,6 @@ func configFilesWatcher(
|
|||||||
return nil, fmt.Errorf("creating watcher: %w", err)
|
return nil, fmt.Errorf("creating watcher: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = watcher.Add(mainFilePath); err != nil {
|
|
||||||
watcher.Close()
|
|
||||||
return nil, fmt.Errorf("adding main file to watcher: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
updateWatchedFiles := func(previousWatched map[string]struct{}, newWatched map[string]struct{}) {
|
updateWatchedFiles := func(previousWatched map[string]struct{}, newWatched map[string]struct{}) {
|
||||||
for filePath := range previousWatched {
|
for filePath := range previousWatched {
|
||||||
if _, ok := newWatched[filePath]; !ok {
|
if _, ok := newWatched[filePath]; !ok {
|
||||||
@ -208,12 +203,13 @@ func configFilesWatcher(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: refactor, flaky
|
||||||
|
currentIncludes[mainFileAbsPath] = struct{}{}
|
||||||
|
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
defer mu.Unlock()
|
defer mu.Unlock()
|
||||||
|
|
||||||
if !maps.Equal(currentIncludes, lastIncludes) {
|
if !maps.Equal(currentIncludes, lastIncludes) {
|
||||||
// TODO: refactor, flaky
|
|
||||||
currentIncludes[mainFileAbsPath] = struct{}{}
|
|
||||||
updateWatchedFiles(lastIncludes, currentIncludes)
|
updateWatchedFiles(lastIncludes, currentIncludes)
|
||||||
lastIncludes = currentIncludes
|
lastIncludes = currentIncludes
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user