refactor: buildin client

This commit is contained in:
Simon Ding
2025-04-23 14:35:18 +08:00
parent 8973fe9d5d
commit 2267b0450a
3 changed files with 44 additions and 29 deletions

View File

@@ -65,6 +65,8 @@ func (c *Engine) reloadUsingBuildinDownloader(h *ent.History) error {
if err != nil {
return errors.Wrap(err, "download torrent")
}
t.Start()
c.tasks.Store(h.ID, &Task{Torrent: t})
return nil
}
@@ -137,6 +139,14 @@ func (c *Engine) reloadTasks() {
}
c.tasks.Store(t.ID, &Task{Torrent: to})
}
} else if dl.Implementation == downloadclients.ImplementationBuildin {
err := c.reloadUsingBuildinDownloader(t)
if err != nil {
log.Warnf("buildin downloader error: %v", err)
} else {
log.Infof("success reloading buildin task: %v", t.SourceTitle)
}
}
}