fix(now-playing): EMG-поллер не фильтрует по isOnline + чинит ошибочный offline

health-check ошибочно метит HLS-потоки emgsound как offline → поллер их пропускал.
Теперь поллим все emgsound-станции и при успешном получении трека ставим isOnline=true.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
nk
2026-06-03 15:34:05 +03:00
parent 38b2aee26d
commit 499863744f

View File

@@ -34,8 +34,9 @@ export class EmgNowPlayingService {
@Interval(30000)
async pollEmgNowPlaying() {
// Не фильтруем по isOnline: health-check ошибочно метит HLS-потоки offline.
const stations = await this.prisma.station.findMany({
where: { isOnline: true, streamUrl: { contains: 'emgsound.ru' } },
where: { streamUrl: { contains: 'emgsound.ru' } },
});
if (stations.length === 0) return;
@@ -64,6 +65,13 @@ export class EmgNowPlayingService {
song: cur.title.trim(),
coverUrl: cur.coverImageWebpUrl600 ?? cur.coverImageUrl600 ?? null,
});
// Станция явно в эфире — поправим ошибочный offline-флаг
if (!station.isOnline) {
await this.prisma.station.update({
where: { id: station.id },
data: { isOnline: true },
});
}
updated++;
}),
);