Get more info first before reading progress status and links

This commit is contained in:
Ben Adrian Sarmiento
2024-07-12 18:27:35 +02:00
parent 7d6deba5bd
commit 964746ab96

View File

@@ -38,21 +38,20 @@ func (t *TorrentManager) refreshTorrents(initialRun bool) {
idx := i
t.workerPool.Submit(func() {
defer wg.Done()
status := instances[idx].Status
if status != "downloading" && status != "downloaded" && status != "uploading" && status != "queued" && status != "compressing" && status != "waiting_files_selection" {
t.deleteOnceDone(instances[idx].ID, true)
}
if instances[idx].Progress != 100 {
mergeChan <- nil
return
}
tInfo := t.getMoreInfo(instances[idx])
if tInfo == nil {
// just in case!
mergeChan <- nil
return
}
status := tInfo.Status
if status != "downloading" && status != "downloaded" && status != "uploading" && status != "queued" && status != "compressing" && status != "waiting_files_selection" {
t.deleteOnceDone(tInfo.ID, true)
}
if tInfo.Progress != 100 || len(tInfo.Links) == 0 {
mergeChan <- nil
return
}
torrent := t.convertToTorrent(tInfo)
accessKey := t.GetKey(torrent)
freshAccessKeys.Add(accessKey)