Remove get torrents count config and use worker pool on all places

This commit is contained in:
Ben Adrian Sarmiento
2024-06-07 19:19:18 +02:00
parent ce2a56df2e
commit db086b19b3
9 changed files with 131 additions and 57 deletions

View File

@@ -355,7 +355,7 @@ func (t *TorrentManager) mountNewDownloads() {
}
func (t *TorrentManager) StartDownloadsJob() {
_ = t.workerPool.Submit(func() {
t.workerPool.Submit(func() {
remountTicker := time.NewTicker(time.Duration(t.Config.GetDownloadsEveryMins()) * time.Minute)
defer remountTicker.Stop()
@@ -414,7 +414,7 @@ func copyFile(sourcePath, destPath string) error {
}
func (t *TorrentManager) StartDumpJob() {
_ = t.workerPool.Submit(func() {
t.workerPool.Submit(func() {
dumpTicker := time.NewTicker(time.Duration(t.Config.GetDumpTorrentsEveryMins()) * time.Minute)
defer dumpTicker.Stop()
@@ -444,7 +444,7 @@ func (t *TorrentManager) analyzeAllTorrents() {
}
func (t *TorrentManager) StartMediaAnalysisJob() {
_ = t.workerPool.Submit(func() {
t.workerPool.Submit(func() {
for range t.AnalyzeTrigger {
t.analyzeAllTorrents()
}