feat: add system task runner (#5680)

This commit is contained in:
Calcium-Ion
2026-06-24 17:16:21 +08:00
committed by GitHub
parent acb52d0f78
commit 5377192293
39 changed files with 2575 additions and 596 deletions
+13
View File
@@ -101,6 +101,19 @@ func GetAllUnFinishTasks() []*Midjourney {
return tasks
}
// HasUnfinishedMidjourneyTasks reports whether at least one Midjourney task is
// still in progress. It is a cheap existence check (LIMIT 1) used to decide
// whether the midjourney_poll system task needs to run; when no task is pending
// the scheduler skips creating a row entirely.
func HasUnfinishedMidjourneyTasks() bool {
var id int
err := DB.Model(&Midjourney{}).
Where("progress != ?", "100%").
Limit(1).
Pluck("id", &id).Error
return err == nil && id != 0
}
func GetByOnlyMJId(mjId string) *Midjourney {
var mj *Midjourney
var err error