fix: enable deduplication for cache mode
Some checks failed
Docker Build & Push / build-and-test (push) Has been cancelled
Docker Build & Push / docker (push) Has been cancelled

- Cache mode now registers downloaded songs in mappings
- Prevents duplicate downloads in cache mode
- Fixes wasted API calls and duplicate cache files
- Both cache and download modes benefit from deduplication
This commit is contained in:
2026-01-30 14:11:47 -05:00
parent 2297455923
commit bc4e5d9442

View File

@@ -298,11 +298,8 @@ public abstract class BaseDownloadService : IDownloadService
song.LocalPath = localPath; song.LocalPath = localPath;
// Register BEFORE releasing lock to prevent race conditions // Register BEFORE releasing lock to prevent race conditions (both cache and download modes)
if (!isCache) await LocalLibraryService.RegisterDownloadedSongAsync(song, localPath);
{
await LocalLibraryService.RegisterDownloadedSongAsync(song, localPath);
}
// Check if this track belongs to a playlist and update M3U // Check if this track belongs to a playlist and update M3U
if (PlaylistSyncService != null) 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) if (!isCache)
{ {
// Trigger a Subsonic library rescan (with debounce) // Trigger a Subsonic library rescan (with debounce)