mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-26 02:34:58 +08:00
chore: updates
This commit is contained in:
@@ -36,14 +36,21 @@ func (c *Client) mustAddCron(spec string, cmd func()) {
|
|||||||
func (c *Client) checkTasks() {
|
func (c *Client) checkTasks() {
|
||||||
log.Debug("begin check tasks...")
|
log.Debug("begin check tasks...")
|
||||||
for id, t := range c.tasks {
|
for id, t := range c.tasks {
|
||||||
|
r := c.db.GetHistory(id)
|
||||||
if !t.Exists() {
|
if !t.Exists() {
|
||||||
log.Infof("task no longer exists: %v", id)
|
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)
|
delete(c.tasks, id)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Infof("task (%s) percentage done: %d%%", t.Name(), t.Progress())
|
log.Infof("task (%s) percentage done: %d%%", t.Name(), t.Progress())
|
||||||
if t.Progress() == 100 {
|
if t.Progress() == 100 {
|
||||||
r := c.db.GetHistory(id)
|
|
||||||
if r.Status == history.StatusSuccess {
|
if r.Status == history.StatusSuccess {
|
||||||
//task already success, check seed ratio
|
//task already success, check seed ratio
|
||||||
torrent := c.tasks[id]
|
torrent := c.tasks[id]
|
||||||
|
|||||||
@@ -184,21 +184,22 @@ func searchWithTorznab(db *db.Client, queries ...string) []torznab.Result {
|
|||||||
if tor.Disabled {
|
if tor.Disabled {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
for _, q := range queries {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
log.Debugf("search torznab %v with %v", tor.Name, queries)
|
log.Debugf("search torznab %v with %v", tor.Name, queries)
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
for _, q := range queries {
|
|
||||||
resp, err := torznab.Search(tor, q)
|
resp, err := torznab.Search(tor, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("search %s with query %s error: %v", tor.Name, q, err)
|
log.Warnf("search %s with query %s error: %v", tor.Name, q, err)
|
||||||
continue
|
return
|
||||||
}
|
}
|
||||||
resChan <- resp
|
resChan <- resp
|
||||||
}
|
|
||||||
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
go func() {
|
go func() {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
close(resChan) // 在所有的worker完成后关闭Channel
|
close(resChan) // 在所有的worker完成后关闭Channel
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
|
|||||||
width: 300,
|
width: 300,
|
||||||
child: FormBuilderSwitch(
|
child: FormBuilderSwitch(
|
||||||
decoration:
|
decoration:
|
||||||
const InputDecoration(icon: Icon(Icons.filter_alt)),
|
const InputDecoration(icon: Icon(Icons.phone_iphone)),
|
||||||
name: "allow_qiangban",
|
name: "allow_qiangban",
|
||||||
title: const Text("是否下载枪版资源")),
|
title: const Text("是否下载枪版资源")),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user