lens @ cff5600c8abebd1ce988b2185c07e998c4a1d483

fix: Wrap media scan into a go routine

For some unknown reason `ReadExif` hangs when the context is canceled
through signal handling. Perhaps perl-exif tooling is closing on
`SIGNINT`.
diff --git a/pkg/worker/exif_scanner.go b/pkg/worker/exif_scanner.go
index 6d40dbd7435830a06fee5974cda18f20e73f67c0..d7865e39737f316d2fe38599868cd8bb9cf5ea6f 100644
--- a/pkg/worker/exif_scanner.go
+++ b/pkg/worker/exif_scanner.go
@@ -33,8 +33,33 @@
 	return medias, nil
 }
 
+func wrapReadExif(ctx context.Context, path string) (*media.MediaEXIF, error) {
+	c := make(chan *media.MediaEXIF)
+	e := make(chan error)
+	go func() {
+		defer close(c)
+		defer close(e)
+
+		newExif, err := fileop.ReadExif(path)
+		if err != nil {
+			e <- err
+		} else {
+			c <- newExif
+		}
+	}()
+
+	select {
+	case <-ctx.Done():
+		return nil, ctx.Err()
+	case m := <-c:
+		return m, nil
+	case err := <-e:
+		return nil, err
+	}
+}
+
 func (e *EXIFScanner) Process(ctx context.Context, m *media.Media) error {
-	newExif, err := fileop.ReadExif(m.Path)
+	newExif, err := wrapReadExif(ctx, m.Path)
 	if err != nil {
 		return err
 	}