Fix duplication
This commit is contained in:
@@ -23,7 +23,7 @@ func (t *TorrentManager) RefreshTorrents() []string {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
allTorrents, _ := t.DirectoryMap.Get(INT_ALL)
|
||||
expiredFixers := mapset.NewSet[string](t.fixers.Keys()...)
|
||||
expiredFixers := t.ensureDelete.Clone()
|
||||
for i := range instances {
|
||||
idx := i
|
||||
expiredFixers.Remove(instances[idx].ID)
|
||||
@@ -71,6 +71,17 @@ func (t *TorrentManager) RefreshTorrents() []string {
|
||||
expiredFixers.Each(func(fixerID string) bool {
|
||||
t.log.Debugf("Deleting expired fixer %s", fixerID)
|
||||
t.fixers.Remove(fixerID)
|
||||
t.ensureDelete.Remove(fixerID)
|
||||
return false
|
||||
})
|
||||
// ensure delete
|
||||
infoCache, _ := t.DirectoryMap.Get(INT_INFO_CACHE)
|
||||
t.ensureDelete.Each(func(fixerID string) bool {
|
||||
if torrent, exists := infoCache.Get(fixerID); exists && torrent.AnyInProgress() {
|
||||
return false
|
||||
}
|
||||
t.log.Debugf("Ensuring that torrent id=%s is deleted", fixerID)
|
||||
t.Api.DeleteTorrent(fixerID)
|
||||
return false
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user