Reunify workers, add commands

This commit is contained in:
Ben Sarmiento
2024-01-30 16:27:12 +01:00
parent 4e389fa79c
commit 7794e641ab
7 changed files with 29 additions and 54 deletions

View File

@@ -30,17 +30,20 @@ func (t *TorrentManager) handleFixers() {
}
command, _ := t.fixers.Pop(id)
switch command {
case "delete":
case "delete_replaced":
t.log.Debugf("Deleting old id=%s because it's redundant to fixed %s ", id, t.GetKey(torrent))
toDelete = append(toDelete, id)
case "delete_failed":
t.log.Debugf("Deleting failed fixer id=%s of torrent %s", id, t.GetKey(torrent))
toDelete = append(toDelete, id)
case "repair":
t.log.Debugf("Repairing torrent %s again now that fixer id=%s is done", t.GetKey(torrent), id)
toDelete = append(toDelete, id)
t.log.Debugf("Repairing torrent %s again now that fixer is done", t.GetKey(torrent))
repairMe, _ := allTorrents.Get(t.GetKey(torrent))
t.TriggerRepair(repairMe)
}
})
for _, id := range toDelete {
t.log.Debugf("Deleting fixer torrent id=%s", id)
t.Api.DeleteTorrent(id)
infoCache.Remove(id)
t.deleteTorrentFile(id)