remove song end poll

This commit is contained in:
Darius
2026-02-05 23:41:45 +01:00
parent 105fb3aecb
commit 419ec65cc6

View File

@@ -94,36 +94,9 @@ export class HomepageService extends BaseService<null> {
}
this.lastPoll = newPoll;
this.scheduleSongEndPoll(newPoll.tidal_current);
return newPoll;
}
private scheduleSongEndPoll(tidal: TidalGetCurrent | null): void {
this.clearSongEndPoll();
if (!tidal || tidal.status === "paused") {
return;
}
const remainingSeconds = tidal.durationInSeconds - tidal.currentInSeconds;
if (remainingSeconds > 0) {
this.songEndTimeout = setTimeout(
() => {
this.songEndTimeout = null;
this.getFullInformation();
},
(remainingSeconds + 1) * 1000,
);
}
}
private clearSongEndPoll(): void {
if (this.songEndTimeout) {
clearTimeout(this.songEndTimeout);
this.songEndTimeout = null;
}
}
listenForClientChange(): void {
this.sseService.onClientChange((clientChange: SseClientChangeEvent) => {
if (clientChange.clientCount === 0) {
@@ -149,6 +122,5 @@ export class HomepageService extends BaseService<null> {
if (this.pollingInterval) {
clearInterval(this.pollingInterval);
}
this.clearSongEndPoll();
}
}