Small repairs on logic

This commit is contained in:
Ben Adrian Sarmiento
2024-06-18 19:32:56 +02:00
parent d53ba8c973
commit 34a7d6a432
8 changed files with 78 additions and 74 deletions

View File

@@ -16,12 +16,7 @@ import (
"gopkg.in/vansante/go-ffprobe.v2"
)
func inProgressStatus(status string) bool {
return status == "downloading" || status == "uploading" || status == "queued" || status == "compressing"
}
func (t *TorrentManager) refreshTorrents(initialRun bool) {
t.inProgressHashes = mapset.NewSet[string]()
instances, _, err := t.api.GetTorrents(false)
if err != nil {
t.log.Warnf("Cannot get torrents: %v", err)
@@ -45,9 +40,6 @@ func (t *TorrentManager) refreshTorrents(initialRun bool) {
if t.binImmediately(instances[idx].ID) ||
t.binOnceDoneErrorCheck(instances[idx].ID, instances[idx].Status) ||
instances[idx].Progress != 100 {
if inProgressStatus(instances[idx].Status) {
t.inProgressHashes.Add(instances[idx].Hash)
}
mergeChan <- nil
return
}
@@ -84,7 +76,6 @@ func (t *TorrentManager) refreshTorrents(initialRun bool) {
if torrent == nil {
continue
}
accessKey := t.GetKey(torrent)
existing, ok := allTorrents.Get(accessKey)
if !ok {