Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
36907fe2
authored
Mar 14, 2024
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 超过一小时的任务自动失败
parent
bc2b1112
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
+8
-1
controller/midjourney.go
+8
-1
No files found.
controller/midjourney.go
View file @
36907fe2
...
...
@@ -118,10 +118,16 @@ func UpdateMidjourneyTaskBulk() {
for
_
,
responseItem
:=
range
responseItems
{
task
:=
taskM
[
responseItem
.
MjId
]
useTime
:=
(
time
.
Now
()
.
UnixNano
()
/
int64
(
time
.
Millisecond
))
-
task
.
SubmitTime
// 如果时间超过一小时,且进度不是100%,则认为任务失败
if
useTime
>
3600000
&&
task
.
Progress
!=
"100%"
{
responseItem
.
FailReason
=
"上游任务超时(超过1小时)"
responseItem
.
Status
=
"FAILURE"
}
if
!
checkMjTaskNeedUpdate
(
task
,
responseItem
)
{
continue
}
task
.
Code
=
1
task
.
Progress
=
responseItem
.
Progress
task
.
PromptEn
=
responseItem
.
PromptEn
...
...
@@ -140,6 +146,7 @@ func UpdateMidjourneyTaskBulk() {
buttonStr
,
_
:=
json
.
Marshal
(
responseItem
.
Buttons
)
task
.
Buttons
=
string
(
buttonStr
)
}
if
task
.
Progress
!=
"100%"
&&
responseItem
.
FailReason
!=
""
{
common
.
LogInfo
(
ctx
,
task
.
MjId
+
" 构建失败,"
+
task
.
FailReason
)
task
.
Progress
=
"100%"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment