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