From 03eb3541a56aef219282e67cb3f4f1786af50160 Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Fri, 12 Jul 2024 23:04:57 +0200 Subject: [PATCH] Only hash files if library is enabled --- server/scan.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/scan.go b/server/scan.go index 591ffa3..62b2d55 100644 --- a/server/scan.go +++ b/server/scan.go @@ -129,7 +129,7 @@ func manageScan(stop chan bool, scanPool *workerpool.WorkerPool, hashPool *worke hashRunning = false }() - rows, err := db.Query(ctx, "SELECT id FROM files WHERE status = $1 OR status = $2 LIMIT 10", constants.FILE_STATUS_CHANGED, constants.FILE_STATUS_NEW) + rows, err := db.Query(ctx, "SELECT f.id FROM files f INNER JOIN libraries l ON f.library_id = l.id WHERE l.enabled = true AND (f.status = $1 OR f.status = $2) LIMIT 10", constants.FILE_STATUS_CHANGED, constants.FILE_STATUS_NEW) if err != nil { if !errors.Is(err, pgx.ErrNoRows) { slog.ErrorContext(ctx, "Error Getting Files for Hashing", "err", err)