Fix repairs

This commit is contained in:
Ben Sarmiento
2024-01-18 20:54:41 +01:00
parent 49fd17c3d4
commit 0a451cccde
4 changed files with 93 additions and 77 deletions

View File

@@ -28,8 +28,8 @@ type TorrentManager struct {
DownloadCache cmap.ConcurrentMap[string, *realdebrid.Download]
DownloadMap cmap.ConcurrentMap[string, *realdebrid.Download]
Repairs cmap.ConcurrentMap[string, bool]
onlyForRepair cmap.ConcurrentMap[string, *Torrent]
allAccessKeys mapset.Set[string]
onlyForRepair mapset.Set[string]
latestState *LibraryState
requiredVersion string
workerPool *ants.Pool
@@ -43,8 +43,12 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p
t := &TorrentManager{
Config: cfg,
Api: api,
DirectoryMap: cmap.New[cmap.ConcurrentMap[string, *Torrent]](),
DownloadCache: cmap.New[*realdebrid.Download](),
DownloadMap: cmap.New[*realdebrid.Download](),
onlyForRepair: cmap.New[*Torrent](),
Repairs: cmap.New[bool](),
allAccessKeys: mapset.NewSet[string](),
onlyForRepair: mapset.NewSet[string](),
latestState: &LibraryState{},
requiredVersion: "11.01.2024",
workerPool: p,
@@ -52,7 +56,6 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p
}
// create internal directories
t.DirectoryMap = cmap.New[cmap.ConcurrentMap[string, *Torrent]]()
t.DirectoryMap.Set(INT_ALL, cmap.New[*Torrent]()) // key is GetAccessKey()
t.DirectoryMap.Set(INT_INFO_CACHE, cmap.New[*Torrent]()) // key is Torrent ID
// create directory maps
@@ -61,9 +64,6 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p
}
// Fetch downloads
t.DownloadCache = cmap.New[*realdebrid.Download]()
t.DownloadMap = cmap.New[*realdebrid.Download]()
t.Repairs = cmap.New[bool]()
if t.Config.EnableDownloadCache() {
_ = t.workerPool.Submit(func() {
page := 1