From 0eeb295c2364ef77ab09789711efed8a84d6c6b0 Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Wed, 7 Feb 2024 13:39:13 +0100 Subject: [PATCH] Use go functions instead of the worker pool --- internal/torrent/refresh.go | 4 ++-- internal/torrent/repair.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/torrent/refresh.go b/internal/torrent/refresh.go index 26ca77a..071feb9 100644 --- a/internal/torrent/refresh.go +++ b/internal/torrent/refresh.go @@ -107,7 +107,7 @@ func (t *TorrentManager) refreshTorrents(isInitialRun bool) []string { // StartRefreshJob periodically refreshes the torrents func (t *TorrentManager) StartRefreshJob() { - _ = t.workerPool.Submit(func() { + go func() { t.log.Info("Starting periodic refresh job") refreshTicker := time.NewTicker(time.Duration(t.Config.GetRefreshEverySecs()) * time.Second) defer refreshTicker.Stop() @@ -131,7 +131,7 @@ func (t *TorrentManager) StartRefreshJob() { return } } - }) + }() } // getMoreInfo gets original name, size and files for a torrent diff --git a/internal/torrent/repair.go b/internal/torrent/repair.go index fb280fa..4561729 100644 --- a/internal/torrent/repair.go +++ b/internal/torrent/repair.go @@ -25,7 +25,7 @@ func (t *TorrentManager) StartRepairJob() { t.repairTrigger = make(chan *Torrent) t.repairSet = mapset.NewSet[*Torrent]() // there is 1 repair worker, with max 1 blocking task - _ = t.workerPool.Submit(func() { + go func() { t.log.Info("Starting periodic repair job") repairTicker := time.NewTicker(time.Duration(t.Config.GetRepairEveryMins()) * time.Minute) defer repairTicker.Stop() @@ -42,7 +42,7 @@ func (t *TorrentManager) StartRepairJob() { return } } - }) + }() } func (t *TorrentManager) invokeRepair(torrent *Torrent) {