Track deletes within refresh
This commit is contained in:
@@ -38,8 +38,7 @@ type TorrentManager struct {
|
|||||||
RepairKillSwitch chan struct{}
|
RepairKillSwitch chan struct{}
|
||||||
RemountTrigger chan struct{}
|
RemountTrigger chan struct{}
|
||||||
|
|
||||||
latestState *LibraryState
|
latestState *LibraryState
|
||||||
allAccessKeys mapset.Set[string]
|
|
||||||
|
|
||||||
fixers cmap.ConcurrentMap[string, string] // trigger -> [command, id]
|
fixers cmap.ConcurrentMap[string, string] // trigger -> [command, id]
|
||||||
repairTrigger chan *Torrent
|
repairTrigger chan *Torrent
|
||||||
@@ -69,8 +68,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
|
|||||||
RepairKillSwitch: make(chan struct{}, 1),
|
RepairKillSwitch: make(chan struct{}, 1),
|
||||||
RemountTrigger: make(chan struct{}, 1),
|
RemountTrigger: make(chan struct{}, 1),
|
||||||
|
|
||||||
latestState: &LibraryState{},
|
latestState: &LibraryState{},
|
||||||
allAccessKeys: mapset.NewSet[string](), // this is for tracking what is deleted
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t.fixers = t.readFixersFromFile()
|
t.fixers = t.readFixersFromFile()
|
||||||
|
|||||||
@@ -80,12 +80,11 @@ func (t *TorrentManager) refreshTorrents(isInitialRun bool) []string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// removed torrents
|
// removed torrents
|
||||||
t.allAccessKeys.Difference(freshAccessKeys).Each(func(accessKey string) bool {
|
allAccessKeys := mapset.NewSet[string](allTorrents.Keys()...)
|
||||||
|
allAccessKeys.Difference(freshAccessKeys).Each(func(accessKey string) bool {
|
||||||
t.Delete(accessKey, false)
|
t.Delete(accessKey, false)
|
||||||
t.allAccessKeys.Remove(accessKey)
|
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
t.allAccessKeys.Append(freshAccessKeys.ToSlice()...)
|
|
||||||
|
|
||||||
t.log.Infof("Compiled into %d torrents, %d were missing info", allTorrents.Count(), noInfoCount)
|
t.log.Infof("Compiled into %d torrents, %d were missing info", allTorrents.Count(), noInfoCount)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user