From 80c96d283c72cd93fa09034c62ba7301e587280f Mon Sep 17 00:00:00 2001 From: iHeyTang Date: Fri, 5 Sep 2025 00:19:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E9=99=90=E5=88=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 template.controller.ts 中的任务数量检查逻辑,将限制条件从大于 0 改为大于 3,以更严格地控制用户并发任务数量。 - 更新异常消息,确保反馈的任务数量与实际正在进行的任务一致。 --- src/controllers/template.controller.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/controllers/template.controller.ts b/src/controllers/template.controller.ts index 317f8cf..c4d5163 100644 --- a/src/controllers/template.controller.ts +++ b/src/controllers/template.controller.ts @@ -230,12 +230,13 @@ export class TemplateController { // 检查是否有任务在5分钟内开始 const recentTasks = processingTasks.filter( - (task) => task.startedAt && task.startedAt.getTime() > fiveMinutesAgo.getTime(), + (task) => + task.startedAt && task.startedAt.getTime() > fiveMinutesAgo.getTime(), ); - if (recentTasks.length > 0) { + if (recentTasks.length > 3) { throw new HttpException( - `有${processingTasks.length}个任务正在进行中,请稍后再试`, + `有${recentTasks.length}个任务正在进行中,请稍后再试`, HttpStatus.TOO_MANY_REQUESTS, ); }