mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 19:47:47 +08:00
chore: add log
This commit is contained in:
@@ -25,6 +25,7 @@ func (s *Server) checkTasks() {
|
|||||||
log.Infof("begin check tasks...")
|
log.Infof("begin check tasks...")
|
||||||
for id, t := range s.tasks {
|
for id, t := range s.tasks {
|
||||||
if !t.Exists() {
|
if !t.Exists() {
|
||||||
|
log.Infof("task no longer exists: %v", t.Name())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Infof("task (%s) percentage done: %d%%", t.Name(), t.Progress())
|
log.Infof("task (%s) percentage done: %d%%", t.Name(), t.Progress())
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ type Server struct {
|
|||||||
tasks map[int]pkg.Torrent
|
tasks map[int]pkg.Torrent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (s *Server) Serve() error {
|
func (s *Server) Serve() error {
|
||||||
s.scheduler()
|
s.scheduler()
|
||||||
s.reloadTasks()
|
s.reloadTasks()
|
||||||
@@ -107,14 +106,13 @@ func (s *Server) MustTMDB() *tmdb.Client {
|
|||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (s *Server) reloadTasks() {
|
func (s *Server) reloadTasks() {
|
||||||
runningTasks := s.db.GetRunningHistories()
|
runningTasks := s.db.GetRunningHistories()
|
||||||
if len(runningTasks) == 0 {
|
if len(runningTasks) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, t := range runningTasks {
|
for _, t := range runningTasks {
|
||||||
log.Infof("reloading task: %s", t.SourceTitle)
|
log.Infof("reloading task: %d %s", t.ID, t.SourceTitle)
|
||||||
torrent, err := transmission.ReloadTorrent(t.Saved)
|
torrent, err := transmission.ReloadTorrent(t.Saved)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("relaod task %s failed: %v", t.SourceTitle, err)
|
log.Errorf("relaod task %s failed: %v", t.SourceTitle, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user