diff --git a/internal/torrent/latestState.go b/internal/torrent/latestState.go index 4167d71..726f5b1 100644 --- a/internal/torrent/latestState.go +++ b/internal/torrent/latestState.go @@ -38,19 +38,22 @@ func (t *TorrentManager) getCurrentState() LibraryState { torrents, totalCount, err := t.rd.GetTorrents(true) if err != nil { t.log.Errorf("Checksum API Error (GetTorrents): %v", err) - return LibraryState{} - } - state.TotalCount = totalCount - if len(torrents) > 0 { - state.FirstTorrentId = torrents[0].ID + state.TotalCount = t.latestState.TotalCount + state.FirstTorrentId = t.latestState.FirstTorrentId + } else { + state.TotalCount = totalCount + if len(torrents) > 0 { + state.FirstTorrentId = torrents[0].ID + } } count, err := t.rd.GetActiveTorrentCount() if err != nil { t.log.Errorf("Checksum API Error (GetActiveTorrentCount): %v", err) - return LibraryState{} + state.ActiveCount = t.latestState.ActiveCount + } else { + state.ActiveCount = count.DownloadingCount } - state.ActiveCount = count.DownloadingCount return state }