Merge even if in progress
This commit is contained in:
@@ -45,13 +45,18 @@ func (t *TorrentManager) refreshTorrents(isInitialRun bool) []string {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
accessKey := t.GetKey(info)
|
accessKey := t.GetKey(info)
|
||||||
if !info.AnyInProgress() {
|
if !info.AnyInProgress() { // since it's single instance info, Any == All
|
||||||
newlyFetchedKeys.Add(accessKey)
|
newlyFetchedKeys.Add(accessKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
if torrent, exists := allTorrents.Get(accessKey); !exists {
|
torrent, exists := allTorrents.Get(accessKey)
|
||||||
|
if !exists {
|
||||||
allTorrents.Set(accessKey, info)
|
allTorrents.Set(accessKey, info)
|
||||||
} else if !info.DownloadedIDs.Difference(torrent.DownloadedIDs).IsEmpty() {
|
continue
|
||||||
|
}
|
||||||
|
newIDs := info.DownloadedIDs.Union(info.InProgressIDs)
|
||||||
|
oldIDs := torrent.DownloadedIDs.Union(torrent.InProgressIDs)
|
||||||
|
if !newIDs.Difference(oldIDs).IsEmpty() {
|
||||||
mainTorrent := t.mergeToMain(torrent, info)
|
mainTorrent := t.mergeToMain(torrent, info)
|
||||||
allTorrents.Set(accessKey, &mainTorrent)
|
allTorrents.Set(accessKey, &mainTorrent)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user