diff options
| -rw-r--r-- | cmd/galleryd/main.go | 5 | ||||
| -rw-r--r-- | internal/watcher/watcher.go | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/cmd/galleryd/main.go b/cmd/galleryd/main.go index 27faa5d..e610cbc 100644 --- a/cmd/galleryd/main.go +++ b/cmd/galleryd/main.go @@ -72,6 +72,11 @@ func main() { fswatcher := watcher.New(watcher.Config{ Roots: dirs, + OnChange: func() { + if err := galleryService.Reload(context.Background()); err != nil { + log.Printf("reload gallery: %v", err) + } + }, }) thumbnailGenerator, err := thumbnail.New(*cacheDir) diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go index ee16b7b..303eced 100644 --- a/internal/watcher/watcher.go +++ b/internal/watcher/watcher.go @@ -15,6 +15,6 @@ func New(config Config) *Watcher { return &Watcher{ config: config, - debounce: make(chan struct{}), + debounce: make(chan struct{}, 1), } } |