Small repairs on logic

This commit is contained in:
Ben Adrian Sarmiento
2024-06-18 19:32:56 +02:00
parent d53ba8c973
commit 34a7d6a432
8 changed files with 78 additions and 74 deletions

View File

@@ -46,8 +46,7 @@ type TorrentManager struct {
DumpTrigger chan struct{}
AnalyzeTrigger chan struct{}
latestState *LibraryState
inProgressHashes mapset.Set[string]
latestState *LibraryState
repairChan chan *Torrent
RepairQueue mapset.Set[*Torrent]
@@ -85,6 +84,9 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
AnalyzeTrigger: make(chan struct{}, 1),
latestState: &LibraryState{log: log},
ImmediateBin: mapset.NewSet[string](),
OnceDoneBin: mapset.NewSet[string](),
}
t.initializeBins()
@@ -236,6 +238,7 @@ func (t *TorrentManager) applyMediaInfoDetails(torrent *Torrent) {
unrestrict := t.UnrestrictFileUntilOk(file, true)
if unrestrict == nil {
file.State.Event(context.Background(), "break_file")
t.EnqueueForRepair(torrent)
changesApplied = true
return
}