perf: add batch offline cache command to replace sequential IPC loops

Add v2_cache_tracks_batch_for_offline command that inserts all tracks
in a single SQLite transaction and spawns download tasks in one IPC
call. Extract spawn_track_cache_download helper shared by both single
and batch commands.

Replace sequential for-of loops with batch calls in PlaylistDetailView
and +page.svelte (downloadAlbumById, handleDownloadAlbum,
handleReDownloadAlbum, reDownloadAlbumById). Single-track handlers
remain unchanged.

Reduces 75 IPC round-trips to 1 for bulk downloads.
This commit is contained in:
vicrodh committed 2026-02-17 10:59:02 -06:00
1 parent 343bfff357
commit 644571f82a
6 files changed
+284 -126

No files matched your search

+1
View File
@@ -844,6 +844,7 @@ pub fn run() {
commands_v2::v2_show_track_notification,
commands_v2::v2_subscribe_playlist,
commands_v2::v2_cache_track_for_offline,
commands_v2::v2_cache_tracks_batch_for_offline,
commands_v2::v2_start_legacy_migration,
commands_v2::v2_library_scan,
commands_v2::v2_library_stop_scan,