diff --git a/server/core/scheduler.go b/server/core/scheduler.go index d9047f0..3ad029f 100644 --- a/server/core/scheduler.go +++ b/server/core/scheduler.go @@ -36,14 +36,21 @@ func (c *Client) mustAddCron(spec string, cmd func()) { func (c *Client) checkTasks() { log.Debug("begin check tasks...") for id, t := range c.tasks { + r := c.db.GetHistory(id) if !t.Exists() { log.Infof("task no longer exists: %v", id) + + if r.Status == history.StatusRunning || r.Status == history.StatusUploading { + log.Warnf("task is running but no longer available in download client, mark as fail, task name: %s", r.SourceTitle) + c.db.SetHistoryStatus(id, history.StatusFail) + } + delete(c.tasks, id) continue } log.Infof("task (%s) percentage done: %d%%", t.Name(), t.Progress()) if t.Progress() == 100 { - r := c.db.GetHistory(id) + if r.Status == history.StatusSuccess { //task already success, check seed ratio torrent := c.tasks[id] diff --git a/server/core/torrent.go b/server/core/torrent.go index 32a0316..ec37d11 100644 --- a/server/core/torrent.go +++ b/server/core/torrent.go @@ -184,20 +184,21 @@ func searchWithTorznab(db *db.Client, queries ...string) []torznab.Result { if tor.Disabled { continue } - wg.Add(1) - go func() { - log.Debugf("search torznab %v with %v", tor.Name, queries) - defer wg.Done() - for _, q := range queries { + for _, q := range queries { + wg.Add(1) + + go func() { + log.Debugf("search torznab %v with %v", tor.Name, queries) + defer wg.Done() + resp, err := torznab.Search(tor, q) if err != nil { log.Warnf("search %s with query %s error: %v", tor.Name, q, err) - continue + return } resChan <- resp - } - - }() + }() + } } go func() { wg.Wait() diff --git a/ui/lib/settings/general.dart b/ui/lib/settings/general.dart index 7c81df0..48824e7 100644 --- a/ui/lib/settings/general.dart +++ b/ui/lib/settings/general.dart @@ -92,7 +92,7 @@ class _GeneralState extends ConsumerState { width: 300, child: FormBuilderSwitch( decoration: - const InputDecoration(icon: Icon(Icons.filter_alt)), + const InputDecoration(icon: Icon(Icons.phone_iphone)), name: "allow_qiangban", title: const Text("是否下载枪版资源")), ),