From 1ec27f9aff3dc819691386a2ac584e889d383316 Mon Sep 17 00:00:00 2001 From: Frank Stellmacher Date: Tue, 21 Apr 2026 21:37:52 +0200 Subject: [PATCH] perf(device-sync): parallelise getAlbum calls when syncing an artist source (#246) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fetchTracksForSource() iterated over an artist's albums with sequential `await getAlbum(...)` inside a for-loop. A 50-album artist sync stalled for ~7 seconds of round-trips before any device write started. Switch to Promise.all(albums.map(...)). Same pattern ArtistDetail.tsx already uses for "Play All" without issues — Navidrome handles parallel getAlbum requests fine. Per-album errors fall back to an empty song list rather than aborting the whole sync. Co-authored-by: Psychotoxical Co-authored-by: Claude Opus 4.7 (1M context) --- src/pages/DeviceSync.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/DeviceSync.tsx b/src/pages/DeviceSync.tsx index 3d368900..37096fd0 100644 --- a/src/pages/DeviceSync.tsx +++ b/src/pages/DeviceSync.tsx @@ -63,9 +63,13 @@ async function fetchTracksForSource(source: DeviceSyncSource): Promise getAlbum(a.id).then(r => r.songs).catch(() => [] as SubsonicSong[])), + ); + return results.flat(); } /** Tracks that came from `calculate_sync_payload` may carry embedded playlist