aboutsummaryrefslogtreecommitdiff
path: root/internal/service/reload.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/service/reload.go')
-rw-r--r--internal/service/reload.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/service/reload.go b/internal/service/reload.go
index 98e4710..9460dbc 100644
--- a/internal/service/reload.go
+++ b/internal/service/reload.go
@@ -6,7 +6,7 @@ import (
"github.com/RanXom/galleryd/internal/gallery"
)
-// Load scans the configured roots and rebuilds the in-memory gallery.
+// Reload scans the configured roots and rebuilds the in-memory gallery.
func (s *galleryService) Reload(ctx context.Context) error {
files, err := s.scanner.Scan(ctx)
if err != nil {
@@ -27,7 +27,9 @@ func (s *galleryService) Reload(ctx context.Context) error {
index.byID[photo.ID] = photo
}
+ s.mu.Lock()
s.index = index
+ s.mu.Unlock()
return nil
}