feat: 为大图片生成缩略图,加快前端图片加载速度

This commit is contained in:
RockYang
2023-11-28 12:04:02 +08:00
parent b05c63549d
commit ce8fa79206
4 changed files with 77 additions and 56 deletions

View File

@@ -72,11 +72,17 @@ func (s *Service) Run() {
}
if err != nil {
logger.Error("绘画任务执行失败:", err)
if task.RetryCount <= 5 {
s.taskQueue.RPush(task)
// 推送任务到前端
client := s.Clients.Get(task.SessionId)
if client != nil {
utils.ReplyChunkMessage(client, vo.MidJourneyJob{
Type: task.Type.String(),
UserId: task.UserId,
MessageId: task.MessageId,
Progress: -1,
Prompt: task.Prompt,
})
}
task.RetryCount += 1
time.Sleep(time.Second * 3)
continue
}