Self-hosted web interface and downloader for Qobuz.

refactor(library): decompose folder scanner and use monotonic lru counter #9

Open glerp.sullen.net
targeting main from glerp.sullen.net/gobuz:hygiene/library-scanner-cache
Open opened by and assigned to glerp.sullen.net
targeting main from glerp.sullen.net/gobuz:hygiene/library-scanner-cache

Summary #

  • Decompose ScanMusicFolders into cohesive stages (internal/library/scanner.go): Extract walkMusicFolder, scanAudioDirs, resolveAudioDir, and mergeScannedRelease from the monolithic 185-line ScanMusicFolders loop, lift dirInfo, audioDirJob, and scanResult out of the loop body, and drop the always-nil error return from parseReleaseMetadata along with its unreachable error branch.
  • Deterministic LRU eviction & stdlib map pruning (internal/library/cache.go, internal/library/cache_test.go): Replace time.Now().UnixNano() and raw int64 atomics in ThumbnailCache with a strictly monotonic atomic.Uint64 access counter (seq) so LRU eviction is deterministic without wall-clock time.Sleep delays in tests, and use maps.DeleteFunc in DirCache.PruneKeeping.
  • Simplify image resize clamping (internal/library/image.go): Use builtin max when computing target dimensions in ResizeImage.
Commits 0