chore: add debug logs to now-playing polling

This commit is contained in:
nk
2026-06-02 19:40:19 +03:00
parent 7823b17d55
commit d082a1ce07
2 changed files with 18 additions and 1 deletions

View File

@@ -26,10 +26,13 @@ export class NowPlayingService {
private readonly prisma: PrismaService,
private readonly gateway: NowPlayingGateway,
private readonly recordSync: RecordStationSyncService,
) {}
) {
this.logger.log('NowPlayingService initialized');
}
@Interval(30000)
async pollRecordNowPlaying() {
this.logger.debug('Polling Record now playing...');
try {
const response = await fetch(
'https://www.radiorecord.ru/api/stations/now/',
@@ -44,6 +47,7 @@ export class NowPlayingService {
result: RecordNowPlayingItem[];
};
const nowPlaying = data.result ?? [];
let updatedCount = 0;
for (const np of nowPlaying) {
const stationId =
@@ -73,7 +77,12 @@ export class NowPlayingService {
coverUrl,
updatedAt: updated.updatedAt,
});
updatedCount++;
}
this.logger.log(
`Polled ${nowPlaying.length} entries, updated ${updatedCount} stations`,
);
} catch (error) {
this.logger.error(`Failed to poll now playing: ${error.message}`);
}