mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-13 07:40:56 +00:00
feat: add system task runner (#5680)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user