Failure case for latest state
This commit is contained in:
@@ -38,19 +38,22 @@ func (t *TorrentManager) getCurrentState() LibraryState {
|
|||||||
torrents, totalCount, err := t.rd.GetTorrents(true)
|
torrents, totalCount, err := t.rd.GetTorrents(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.log.Errorf("Checksum API Error (GetTorrents): %v", err)
|
t.log.Errorf("Checksum API Error (GetTorrents): %v", err)
|
||||||
return LibraryState{}
|
state.TotalCount = t.latestState.TotalCount
|
||||||
}
|
state.FirstTorrentId = t.latestState.FirstTorrentId
|
||||||
state.TotalCount = totalCount
|
} else {
|
||||||
if len(torrents) > 0 {
|
state.TotalCount = totalCount
|
||||||
state.FirstTorrentId = torrents[0].ID
|
if len(torrents) > 0 {
|
||||||
|
state.FirstTorrentId = torrents[0].ID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
count, err := t.rd.GetActiveTorrentCount()
|
count, err := t.rd.GetActiveTorrentCount()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.log.Errorf("Checksum API Error (GetActiveTorrentCount): %v", err)
|
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
|
return state
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user