mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 18:23:45 +08:00
feat: add err_msg field for mj and sd jobs
This commit is contained in:
@@ -86,9 +86,13 @@ func (s *Service) Run() {
|
||||
}
|
||||
|
||||
if err != nil || (res.Code != 1 && res.Code != 22) {
|
||||
logger.Error("绘画任务执行失败:", err, res.Description)
|
||||
errMsg := err.Error() + res.Description
|
||||
logger.Error("绘画任务执行失败:", errMsg)
|
||||
// update the task progress
|
||||
s.db.Model(&model.MidJourneyJob{Id: uint(task.Id)}).UpdateColumn("progress", -1)
|
||||
s.db.Model(&model.MidJourneyJob{Id: uint(task.Id)}).UpdateColumns(map[string]interface{}{
|
||||
"progress": -1,
|
||||
"err_msg": errMsg,
|
||||
})
|
||||
// 任务失败,通知前端
|
||||
s.notifyQueue.RPush(task.UserId)
|
||||
// restore img_call quota
|
||||
|
||||
@@ -217,7 +217,10 @@ func (p *ServicePool) SyncTaskProgress() {
|
||||
}
|
||||
// 任务失败了
|
||||
if task.FailReason != "" {
|
||||
p.db.Model(&model.MidJourneyJob{Id: v.Id}).UpdateColumn("progress", -1)
|
||||
p.db.Model(&model.MidJourneyJob{Id: v.Id}).UpdateColumns(map[string]interface{}{
|
||||
"progress": -1,
|
||||
"err_msg": task.FailReason,
|
||||
})
|
||||
continue
|
||||
}
|
||||
if len(task.Buttons) > 0 {
|
||||
|
||||
@@ -82,9 +82,12 @@ func (s *Service) Run() {
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
logger.Error("绘画任务执行失败:", err)
|
||||
logger.Error("绘画任务执行失败:", err.Error())
|
||||
// update the task progress
|
||||
s.db.Model(&model.MidJourneyJob{Id: uint(task.Id)}).UpdateColumn("progress", -1)
|
||||
s.db.Model(&model.MidJourneyJob{Id: uint(task.Id)}).UpdateColumns(map[string]interface{}{
|
||||
"progress": -1,
|
||||
"err_msg": err.Error(),
|
||||
})
|
||||
s.notifyQueue.RPush(task.UserId)
|
||||
// restore img_call quota
|
||||
if task.Type.String() != types.TaskUpscale.String() {
|
||||
|
||||
Reference in New Issue
Block a user