Fix: Refresh disk space notification during pause and after reconnection

This commit is contained in:
destrodxbad 2025-11-14 20:29:38 +01:00
parent 6db556ed5c
commit e606501834

View file

@ -31,7 +31,6 @@ export class TorrentService {
.withUrl(`${this.baseHref}hub`) .withUrl(`${this.baseHref}hub`)
.withAutomaticReconnect() .withAutomaticReconnect()
.build(); .build();
this.connection.start().catch((err) => console.error(err));
this.connection.on('update', (torrents: Torrent[]) => { this.connection.on('update', (torrents: Torrent[]) => {
this.update$.next(torrents); this.update$.next(torrents);
@ -40,6 +39,18 @@ export class TorrentService {
this.connection.on('diskSpaceStatus', (status: any) => { this.connection.on('diskSpaceStatus', (status: any) => {
this.diskSpaceStatus$.next(status); this.diskSpaceStatus$.next(status);
}); });
this.connection.onreconnected(() => {
this.getDiskSpaceStatus().subscribe({
next: (status) => {
if (status) {
this.diskSpaceStatus$.next(status);
}
},
});
});
this.connection.start().catch((err) => console.error(err));
} }
public getList(): Observable<Torrent[]> { public getList(): Observable<Torrent[]> {