Prevent double repairs

This commit is contained in:
Ben Sarmiento
2023-12-10 22:57:46 +01:00
parent ff72265bfb
commit 74b6ddc99c
4 changed files with 16 additions and 7 deletions

View File

@@ -23,12 +23,12 @@ func (t *TorrentManager) RefreshTorrents() []string {
var wg sync.WaitGroup
for i := range instances {
wg.Add(1)
idx := i // capture the loop variable
idx := i
_ = t.workerPool.Submit(func() {
defer wg.Done()
infoChan <- t.getMoreInfo(instances[idx])
})
wg.Add(1)
}
wg.Wait()
@@ -43,7 +43,7 @@ func (t *TorrentManager) RefreshTorrents() []string {
noInfoCount++
continue
}
if !info.AllInProgress() {
if !info.AnyInProgress() {
freshKeys.Add(info.AccessKey)
}
if torrent, exists := allTorrents.Get(info.AccessKey); !exists {