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

@@ -31,10 +31,8 @@ type TorrentManager struct {
latestState *LibraryState
requiredVersion string
workerPool *ants.Pool
refreshPool *ants.Pool
RefreshKillSwitch chan struct{}
RepairKillSwitch chan struct{}
repairPool *ants.Pool
repairTrigger chan *Torrent
repairSet mapset.Set[*Torrent]
repairRunning bool
@@ -45,7 +43,7 @@ type TorrentManager struct {
// NewTorrentManager creates a new torrent manager
// it will fetch all torrents and their info in the background
// and store them in-memory and cached in files
func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, workerPool, refreshPool, repairPool *ants.Pool, log *logutil.Logger) *TorrentManager {
func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, workerPool *ants.Pool, log *logutil.Logger) *TorrentManager {
t := &TorrentManager{
Config: cfg,
Api: api,
@@ -58,8 +56,6 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
latestState: &LibraryState{},
requiredVersion: "0.9.3-hotfix.4",
workerPool: workerPool,
refreshPool: refreshPool,
repairPool: repairPool,
log: log,
}
t.fixers = t.readFixersFromFile()