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
ea3e9a01
authored
Dec 03, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 将任务查询数量改为可配置环境变量 TASK_QUERY_LIMIT
parent
64bf6d1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
1 deletions
+4
-1
common/init.go
+2
-0
constant/env.go
+1
-0
controller/task.go
+1
-1
No files found.
common/init.go
View file @
ea3e9a01
...
...
@@ -131,6 +131,8 @@ func initConstantEnv() {
constant
.
GenerateDefaultToken
=
GetEnvOrDefaultBool
(
"GENERATE_DEFAULT_TOKEN"
,
false
)
// 是否启用错误日志
constant
.
ErrorLogEnabled
=
GetEnvOrDefaultBool
(
"ERROR_LOG_ENABLED"
,
false
)
// 任务轮询时查询的最大数量
constant
.
TaskQueryLimit
=
GetEnvOrDefault
(
"TASK_QUERY_LIMIT"
,
1000
)
soraPatchStr
:=
GetEnvOrDefaultString
(
"TASK_PRICE_PATCH"
,
""
)
if
soraPatchStr
!=
""
{
...
...
constant/env.go
View file @
ea3e9a01
...
...
@@ -15,6 +15,7 @@ var NotifyLimitCount int
var
NotificationLimitDurationMinute
int
var
GenerateDefaultToken
bool
var
ErrorLogEnabled
bool
var
TaskQueryLimit
int
// temporary variable for sora patch, will be removed in future
var
TaskPricePatches
[]
string
controller/task.go
View file @
ea3e9a01
...
...
@@ -29,7 +29,7 @@ func UpdateTaskBulk() {
time
.
Sleep
(
time
.
Duration
(
15
)
*
time
.
Second
)
common
.
SysLog
(
"任务进度轮询开始"
)
ctx
:=
context
.
TODO
()
allTasks
:=
model
.
GetAllUnFinishSyncTasks
(
500
)
allTasks
:=
model
.
GetAllUnFinishSyncTasks
(
constant
.
TaskQueryLimit
)
platformTask
:=
make
(
map
[
constant
.
TaskPlatform
][]
*
model
.
Task
)
for
_
,
t
:=
range
allTasks
{
platformTask
[
t
.
Platform
]
=
append
(
platformTask
[
t
.
Platform
],
t
)
...
...
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