fix(enrich): быстрый now-playing проход — только Deezer (без затыка iTunes)

iTunes-фолбэк в coverFast с троттлингом 3.5с сериализовал проход — он не
успевал за сменой треков, покрытие падало. Теперь быстрый проход = только
Deezer (параллельно, без троттла). Промахи Deezer добирает фоновый enrichOne
(iTunes через прокси с троттлингом).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
nk
2026-06-04 16:40:06 +03:00
parent 28487a7911
commit 52c8c3f69f

View File

@@ -143,23 +143,16 @@ export class EnrichmentService {
} }
} }
/** Только обложка для быстрого now-playing-прохода. Deezer первичен (высокий /** Только обложка для быстрого now-playing-прохода — ТОЛЬКО Deezer (через
* лимит, через DE-прокси отдаёт каталог), iTunes — фолбэк (жёстко троттлится). */ * DE-прокси, высокий лимит, параллельно). iTunes здесь НЕ дёргаем: его жёсткий
* троттлинг (3.5с) затыкал бы проход. Промахи Deezer добирает фоновый
* enrichOne (там iTunes через прокси с троттлингом). */
private async fetchCover( private async fetchCover(
artist: string, artist: string,
song: string, song: string,
): Promise<{ coverUrl: string | null; genre: string | null; album: string | null } | null> { ): Promise<{ coverUrl: string | null; genre: string | null; album: string | null } | null> {
const dz = await this.fetchDeezerCover(artist, song); const dz = await this.fetchDeezerCover(artist, song);
if (dz) return { coverUrl: dz, genre: null, album: null }; if (dz) return { coverUrl: dz, genre: null, album: null };
try {
const cleaned =
`${this.stripNoise(artist)} ${this.stripNoise(song)}`.replace(/\s+/g, ' ').trim() ||
`${artist} ${song}`;
const r = await this.itunesSearch(cleaned);
if (r?.coverUrl) return { coverUrl: r.coverUrl, genre: r.genre, album: r.album };
} catch {
// iTunes 429/сеть — добёрём позже
}
return null; return null;
} }