From ada6653bd12aadeeb093c3a8b25a6a244fc8908e Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Fri, 30 Jan 2026 14:10:34 -0500 Subject: [PATCH] fix: enable deduplication for cache mode - Cache mode now registers downloaded songs in mappings - Prevents duplicate downloads in cache mode - Only library scan/album download skip cache mode - Fixes wasted API calls and duplicate cache files --- allstarr/Services/Common/BaseDownloadService.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/allstarr/Services/Common/BaseDownloadService.cs b/allstarr/Services/Common/BaseDownloadService.cs index 26f014a..995ef39 100644 --- a/allstarr/Services/Common/BaseDownloadService.cs +++ b/allstarr/Services/Common/BaseDownloadService.cs @@ -298,11 +298,8 @@ public abstract class BaseDownloadService : IDownloadService song.LocalPath = localPath; - // Register BEFORE releasing lock to prevent race conditions - if (!isCache) - { - await LocalLibraryService.RegisterDownloadedSongAsync(song, localPath); - } + // Register BEFORE releasing lock to prevent race conditions (both cache and download modes) + await LocalLibraryService.RegisterDownloadedSongAsync(song, localPath); // Check if this track belongs to a playlist and update M3U if (PlaylistSyncService != null) @@ -322,7 +319,7 @@ public abstract class BaseDownloadService : IDownloadService } } - // Trigger library scan and album download AFTER releasing lock + // Trigger library scan and album download AFTER releasing lock (download mode only) if (!isCache) { // Trigger a Subsonic library rescan (with debounce)