From 1dbeda88aaa07ec8f279b4bdb3110fa3a9c27d1f Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 14 Nov 2025 22:13:55 -0500 Subject: [PATCH] review Signed-off-by: Deluan --- scanner/folder_entry_test.go | 10 ---------- scanner/phase_1_folders.go | 13 ++++--------- scanner/scanner_selective_test.go | 3 --- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/scanner/folder_entry_test.go b/scanner/folder_entry_test.go index f3b715b8b..0328c6653 100644 --- a/scanner/folder_entry_test.go +++ b/scanner/folder_entry_test.go @@ -52,16 +52,6 @@ var _ = Describe("folder_entry", func() { Expect(entry.updTime).To(Equal(updateInfo.UpdatedAt)) Expect(entry.prevHash).To(Equal(updateInfo.Hash)) }) - - It("creates a new folder entry with zero time when no previous update exists", func() { - folderID := model.FolderID(lib, path) - emptyInfo := model.FolderUpdateInfo{} - - entry := newFolderEntry(job, folderID, path, emptyInfo.UpdatedAt, emptyInfo.Hash) - - Expect(entry.updTime).To(BeZero()) - Expect(entry.prevHash).To(BeEmpty()) - }) }) Describe("createFolderEntry", func() { diff --git a/scanner/phase_1_folders.go b/scanner/phase_1_folders.go index 46c56ba6f..2f6b62b2d 100644 --- a/scanner/phase_1_folders.go +++ b/scanner/phase_1_folders.go @@ -96,6 +96,9 @@ func (j *scanJob) popLastUpdate(folderID string) model.FolderUpdateInfo { return lastUpdate } +// createFolderEntry creates a new folderEntry for the given path, using the last update info from the job +// to populate the previous update time and hash. It also removes the folder from the job's lastUpdates map. +// This is used to track which folders have been found during the walk_dir_tree. func (j *scanJob) createFolderEntry(path string) *folderEntry { id := model.FolderID(j.lib, path) info := j.popLastUpdate(id) @@ -141,15 +144,7 @@ func (p *phaseFolders) producer() ppl.Producer[*folderEntry] { break } - var outputChan <-chan *folderEntry - var err error - - // Use selective folder loading if target folders are specified - if len(job.targetFolders) > 0 { - log.Debug(p.ctx, "Scanner: Loading specific folders and all their subdirectories (recursive)", "lib", job.lib.Name, "numTargets", len(job.targetFolders)) - } - outputChan, err = walkDirTree(p.ctx, job, job.targetFolders...) - + outputChan, err := walkDirTree(p.ctx, job, job.targetFolders...) if err != nil { log.Warn(p.ctx, "Scanner: Error scanning library", "lib", job.lib.Name, err) } diff --git a/scanner/scanner_selective_test.go b/scanner/scanner_selective_test.go index bf289b203..629826db4 100644 --- a/scanner/scanner_selective_test.go +++ b/scanner/scanner_selective_test.go @@ -87,9 +87,6 @@ var _ = Describe("ScanFolders", Ordered, func() { "pop/track6.mp3": pop(track(1, "Pop Track 1")), }) - // Use the existing library from BeforeEach - // (lib is already created with the path "fake:///music") - // Scan only the "rock" and "jazz" folders (including their subdirectories) targets := []model.ScanTarget{ {LibraryID: lib.ID, FolderPath: "rock"},