From 6a058e4191d8c349bb0aa6566ff3440aa9dcfa92 Mon Sep 17 00:00:00 2001 From: Benson Wong Date: Wed, 2 Jul 2025 10:22:39 -0700 Subject: [PATCH] Change fsnotify to watch config directory instead of file The fsnotify library suggests watching a directory and checking that the name matches the configuration file. --- llama-swap.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llama-swap.go b/llama-swap.go index 15e0299..ae5d0fa 100644 --- a/llama-swap.go +++ b/llama-swap.go @@ -117,9 +117,10 @@ func main() { return } - err = watcher.Add(absConfigPath) + configDir := filepath.Dir(absConfigPath) + err = watcher.Add(configDir) if err != nil { - fmt.Printf("Error adding config path (%s) to watcher: %v. File watching disabled.", absConfigPath, err) + fmt.Printf("Error adding config path directory (%s) to watcher: %v. File watching disabled.", configDir, err) return }