Remove immediate bin

This commit is contained in:
Ben Adrian Sarmiento
2024-06-18 23:43:31 +02:00
parent 34a7d6a432
commit acc9b69b5a
8 changed files with 58 additions and 87 deletions

View File

@@ -53,8 +53,8 @@ type TorrentManager struct {
repairRunning bool
repairRunningMu sync.Mutex
ImmediateBin mapset.Set[string]
OnceDoneBin mapset.Set[string]
OnceDoneBin mapset.Set[string]
DeleteOnCompletionBin cmap.ConcurrentMap[string, string]
}
// NewTorrentManager creates a new torrent manager
@@ -85,8 +85,8 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
latestState: &LibraryState{log: log},
ImmediateBin: mapset.NewSet[string](),
OnceDoneBin: mapset.NewSet[string](),
OnceDoneBin: mapset.NewSet[string](),
DeleteOnCompletionBin: cmap.New[string](),
}
t.initializeBins()
@@ -353,6 +353,7 @@ func (t *TorrentManager) mountNewDownloads() {
}
}
// StartDownloadsJob: permanent job for remounting downloads
func (t *TorrentManager) StartDownloadsJob() {
t.workerPool.Submit(func() {
remountTicker := time.NewTicker(time.Duration(t.Config.GetDownloadsEveryMins()) * time.Minute)
@@ -412,6 +413,7 @@ func copyFile(sourcePath, destPath string) error {
return nil
}
// StartDumpJob: permanent job for dumping torrents
func (t *TorrentManager) StartDumpJob() {
t.workerPool.Submit(func() {
dumpTicker := time.NewTicker(time.Duration(t.Config.GetDumpTorrentsEveryMins()) * time.Minute)
@@ -442,6 +444,7 @@ func (t *TorrentManager) analyzeAllTorrents() {
})
}
// StartMediaAnalysisJob: permanent job for analyzing media info (triggered by the user)
func (t *TorrentManager) StartMediaAnalysisJob() {
t.workerPool.Submit(func() {
for range t.AnalyzeTrigger {