diff --git a/client/src/app/torrent-table/torrent-table.component.ts b/client/src/app/torrent-table/torrent-table.component.ts index 1c4799f..da7478f 100644 --- a/client/src/app/torrent-table/torrent-table.component.ts +++ b/client/src/app/torrent-table/torrent-table.component.ts @@ -57,24 +57,23 @@ export class TorrentTableComponent implements OnInit { ) {} ngOnInit(): void { - // Load initial disk space status this.torrentService.getDiskSpaceStatus().subscribe({ next: (status) => { this.diskSpaceStatus = status; }, }); + this.torrentService.diskSpaceStatus$.subscribe((status) => { + this.diskSpaceStatus = status; + }); + + this.torrentService.update$.subscribe((result) => { + this.torrents = result; + }); + this.torrentService.getList().subscribe({ next: (result) => { this.torrents = result; - - this.torrentService.update$.subscribe((result2) => { - this.torrents = result2; - }); - - this.torrentService.diskSpaceStatus$.subscribe((status) => { - this.diskSpaceStatus = status; - }); }, error: (err) => { this.error = err.error; diff --git a/server/RdtClient.Service/BackgroundServices/DiskSpaceMonitor.cs b/server/RdtClient.Service/BackgroundServices/DiskSpaceMonitor.cs index 159b268..a29680c 100644 --- a/server/RdtClient.Service/BackgroundServices/DiskSpaceMonitor.cs +++ b/server/RdtClient.Service/BackgroundServices/DiskSpaceMonitor.cs @@ -48,8 +48,6 @@ public class DiskSpaceMonitor(ILogger logger, IServiceProvider intervalMinutes = 1; } - await Task.Delay(TimeSpan.FromMinutes(intervalMinutes), stoppingToken); - var downloadPath = Settings.Get.DownloadClient.DownloadPath; logger.LogDebug($"Checking disk space for path: {downloadPath}"); @@ -145,6 +143,8 @@ public class DiskSpaceMonitor(ILogger logger, IServiceProvider _lastStatus = status; await remoteService.UpdateDiskSpaceStatus(status); } + + await Task.Delay(TimeSpan.FromMinutes(intervalMinutes), stoppingToken); } catch (Exception ex) {