This commit is contained in:
Ben Sarmiento
2023-12-07 12:49:59 +01:00
parent caa42822ac
commit 42dce61529
3 changed files with 14 additions and 13 deletions

View File

@@ -21,8 +21,8 @@ func (t *TorrentManager) CheckDeletedState(torrent *Torrent) bool {
}
func (t *TorrentManager) Delete(accessKey string, deleteInRD bool) {
allTorrents, _ := t.DirectoryMap.Get(INT_ALL)
if deleteInRD {
allTorrents, _ := t.DirectoryMap.Get(INT_ALL)
infoCache, _ := t.DirectoryMap.Get(INT_INFO_CACHE)
if torrent, ok := allTorrents.Get(accessKey); ok {
torrent.DownloadedIDs.Each(func(id string) bool {
@@ -34,8 +34,10 @@ func (t *TorrentManager) Delete(accessKey string, deleteInRD bool) {
})
}
}
t.allAccessKeys.Remove(accessKey)
t.log.Infof("Removing torrent %s from zurg database", accessKey)
t.DirectoryMap.IterCb(func(directory string, torrents cmap.ConcurrentMap[string, *Torrent]) {
torrents.Remove(accessKey)
})
allTorrents.Remove(accessKey)
}