Add cleanup job for downloaded ids
This commit is contained in:
@@ -142,6 +142,20 @@ func (t *TorrentManager) refreshTorrents() []string {
|
||||
})
|
||||
})
|
||||
|
||||
t.workerPool.Submit(func() {
|
||||
// update DownloadedIDs field of torrents
|
||||
allTorrents.IterCb(func(accessKey string, torrent *Torrent) {
|
||||
deletedIDs := torrent.DownloadedIDs.Difference(freshIDs)
|
||||
if deletedIDs.Cardinality() > 0 {
|
||||
deletedIDs.Each(func(id string) bool {
|
||||
torrent.DownloadedIDs.Remove(id)
|
||||
return false
|
||||
})
|
||||
t.writeTorrentToFile(torrent)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
return updatedPaths.ToSlice()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user