debug(suggestions): add detailed timing logs for debugging
Frontend logging: - Log when effect triggers with artist count - Log when backend call starts/finishes with timing - Log result details (tracks, artists counts) Backend logging (playlist_suggestions.rs): - Log MBID resolution with cache hits/misses/failures - Log config values - Log engine call timing Engine logging (suggestions.rs): - Step 1: ensure_vector timing per artist - Step 2: playlist vector computation - Step 3: find_nearest timing - Step 4: track search timing per artist - Early exit when pool size reached
This commit is contained in:
1 parent
e9a5dfcb80
commit
1560cd4e3d
3 files changed
+101
-11
No files matched your search
@@ -57,28 +57,45 @@
|
||||
// Load suggestions when artists change
|
||||
$effect(() => {
|
||||
if (artists.length > 0 && !hasLoadedOnce) {
|
||||
console.log('[Suggestions] Effect triggered, artists:', artists.length);
|
||||
void loadSuggestions(false);
|
||||
}
|
||||
});
|
||||
|
||||
async function loadSuggestions(expanded: boolean) {
|
||||
if (loading) return;
|
||||
if (loading) {
|
||||
console.log('[Suggestions] Already loading, skipping');
|
||||
return;
|
||||
}
|
||||
|
||||
const poolSize = expanded ? EXPANDED_POOL : INITIAL_POOL;
|
||||
console.log(`[Suggestions] Starting load (expanded=${expanded}, poolSize=${poolSize}, artists=${artists.length})`);
|
||||
const startTime = performance.now();
|
||||
|
||||
loading = true;
|
||||
error = null;
|
||||
|
||||
try {
|
||||
console.log('[Suggestions] Calling backend...');
|
||||
result = await getPlaylistSuggestionsV2(
|
||||
artists,
|
||||
excludeTrackIds,
|
||||
showReasons,
|
||||
{ max_pool_size: expanded ? EXPANDED_POOL : INITIAL_POOL }
|
||||
{ max_pool_size: poolSize }
|
||||
);
|
||||
const elapsed = ((performance.now() - startTime) / 1000).toFixed(2);
|
||||
console.log(`[Suggestions] Backend returned in ${elapsed}s:`, {
|
||||
tracks: result.tracks.length,
|
||||
sourceArtists: result.source_artists.length,
|
||||
playlistArtists: result.playlist_artists_count,
|
||||
similarArtists: result.similar_artists_count
|
||||
});
|
||||
pool = result.tracks;
|
||||
currentPage = 0;
|
||||
hasLoadedOnce = true;
|
||||
} catch (err) {
|
||||
console.error('Failed to load suggestions:', err);
|
||||
const elapsed = ((performance.now() - startTime) / 1000).toFixed(2);
|
||||
console.error(`[Suggestions] Failed after ${elapsed}s:`, err);
|
||||
error = err instanceof Error ? err.message : 'Failed to load suggestions';
|
||||
pool = [];
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user