Bin error checks
This commit is contained in:
@@ -32,44 +32,25 @@ func (t *TorrentManager) refreshTorrents() []string {
|
||||
freshIDs := mapset.NewSet[string]()
|
||||
freshAccessKeys := mapset.NewSet[string]()
|
||||
|
||||
t.getTorrentFiles("dump").Each(func(filePath string) bool {
|
||||
cachedAccessKeys := mapset.NewSet[string]()
|
||||
t.getTorrentFiles("data").Each(func(filePath string) bool {
|
||||
torrent := t.readTorrentFromFile(filePath)
|
||||
if torrent != nil {
|
||||
accessKey := t.GetKey(torrent)
|
||||
if !allTorrents.Has(accessKey) {
|
||||
t.log.Debugf("Loading dumped torrent %s", accessKey)
|
||||
allTorrents.Set(accessKey, torrent)
|
||||
t.assignDirectory(torrent, func(directory string) {
|
||||
listing, _ := t.DirectoryMap.Get(directory)
|
||||
listing.Set(accessKey, torrent)
|
||||
// note that we're not adding it to updatedPaths
|
||||
})
|
||||
}
|
||||
freshAccessKeys.Add(accessKey) // to prevent being deleted
|
||||
allTorrents.Set(t.GetKey(torrent), torrent)
|
||||
filename := filepath.Base(filePath)
|
||||
cachedAccessKeys.Add(strings.TrimSuffix(filename, ".zurgtorrent"))
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
cachedAccessKeys := mapset.NewSet[string]()
|
||||
t.getTorrentFiles("data").Each(func(path string) bool {
|
||||
path = filepath.Base(path)
|
||||
cachedAccessKeys.Add(strings.TrimSuffix(path, ".zurgtorrent"))
|
||||
return false
|
||||
})
|
||||
|
||||
for i := range instances {
|
||||
wg.Add(1)
|
||||
idx := i
|
||||
_ = t.workerPool.Submit(func() {
|
||||
defer wg.Done()
|
||||
if t.binImmediately(instances[idx].ID) {
|
||||
// t.log.Debugf("Skipping trashed torrent %s (id=%s)", instances[idx].Name, instances[idx].ID)
|
||||
mergeChan <- nil
|
||||
return
|
||||
}
|
||||
|
||||
if instances[idx].Progress != 100 {
|
||||
// t.log.Debugf("Skipping incomplete torrent %s (id=%s)", instances[idx].Name, instances[idx].ID)
|
||||
if t.binImmediately(instances[idx].ID) ||
|
||||
t.binOnceDoneErrorCheck(instances[idx].ID, instances[idx].Status) ||
|
||||
instances[idx].Progress != 100 {
|
||||
mergeChan <- nil
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user