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

@@ -40,7 +40,7 @@ func (t *TorrentManager) refreshTorrents(initialRun bool) {
freshIDs.Add(instances[i].ID)
wg.Add(1)
idx := i
_ = t.workerPool.Submit(func() {
t.workerPool.Submit(func() {
defer wg.Done()
if t.binImmediately(instances[idx].ID) ||
t.binOnceDoneErrorCheck(instances[idx].ID, instances[idx].Status) ||
@@ -136,7 +136,7 @@ func (t *TorrentManager) refreshTorrents(initialRun bool) {
// StartRefreshJob periodically refreshes the torrents
func (t *TorrentManager) StartRefreshJob() {
go func() {
t.workerPool.Submit(func() {
t.log.Debug("Starting periodic refresh job")
refreshTicker := time.NewTicker(time.Duration(t.Config.GetRefreshEverySecs()) * time.Second)
defer refreshTicker.Stop()
@@ -157,7 +157,7 @@ func (t *TorrentManager) StartRefreshJob() {
return
}
}
}()
})
}
func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *realdebrid.TorrentInfo {