Add utils

This commit is contained in:
Ben Sarmiento
2024-01-28 20:20:33 +01:00
parent 3cf3351210
commit 573cfa1436
6 changed files with 65 additions and 21 deletions

View File

@@ -66,8 +66,8 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
t.mountDownloads()
t.refreshTorrents()
t.SetNewLatestState(t.getCurrentState())
t.startRefreshJob()
t.startRepairJob()
t.StartRefreshJob()
t.StartRepairJob()
return t
}

View File

@@ -119,8 +119,8 @@ func (t *TorrentManager) refreshTorrents() []string {
return updatedPaths
}
// startRefreshJob periodically refreshes the torrents
func (t *TorrentManager) startRefreshJob() {
// StartRefreshJob periodically refreshes the torrents
func (t *TorrentManager) StartRefreshJob() {
_ = t.refreshPool.Submit(func() {
t.log.Info("Starting periodic refresh job")
for {

View File

@@ -17,7 +17,7 @@ const (
EXPIRED_LINK_TOLERANCE_HOURS = 24
)
func (t *TorrentManager) startRepairJob() {
func (t *TorrentManager) StartRepairJob() {
if !t.Config.EnableRepair() {
t.log.Debug("Repair is disabled, skipping repair job")
return