Refactors 2

This commit is contained in:
Ben Adrian Sarmiento
2024-07-11 22:33:20 +02:00
parent 4aafe5b4fc
commit 7509f0fa59
6 changed files with 12 additions and 48 deletions

View File

@@ -71,10 +71,6 @@ func (t *TorrentManager) refreshTorrents(initialRun bool) {
})
}
t.workerPool.Submit(func() {
t.cleanupBins(freshIDs)
})
wg.Wait()
close(mergeChan)
@@ -116,6 +112,17 @@ func (t *TorrentManager) refreshTorrents(initialRun bool) {
t.log.Infof("Compiled into %d unique torrents", allTorrents.Count())
t.workerPool.Submit(func() {
t.OnceDoneBin.Clone().Each(func(entry string) bool {
// check for: delete once done cases
if !freshIDs.ContainsOne(entry) {
t.OnceDoneBin.Remove(entry)
}
return false
})
t.persistBins()
})
// delete info files that are no longer present
// it also runs binOnceDone (needed for cleanup every refresh)
t.getInfoFiles().Each(func(path string) bool {