From ea3e9a01a0ec5fd45b85065d6014cd8a83e714a1 Mon Sep 17 00:00:00 2001 From: CaIon Date: Wed, 3 Dec 2025 19:27:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=86=E4=BB=BB=E5=8A=A1=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=95=B0=E9=87=8F=E6=94=B9=E4=B8=BA=E5=8F=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=20TASK=5FQUERY=5F?= =?UTF-8?q?LIMIT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/init.go | 2 ++ constant/env.go | 1 + controller/task.go | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/common/init.go b/common/init.go index 715bee99..3f3bd1df 100644 --- a/common/init.go +++ b/common/init.go @@ -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 != "" { diff --git a/constant/env.go b/constant/env.go index 94c2cfcd..975bced7 100644 --- a/constant/env.go +++ b/constant/env.go @@ -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 diff --git a/controller/task.go b/controller/task.go index c14d7e21..ad034d61 100644 --- a/controller/task.go +++ b/controller/task.go @@ -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)