refactor(task): 优化任务获取逻辑

- 在 TaskTaskServiceImpl 中添加 limit(1) 以限制获取的任务数量为 1
- 在 TaskMapper.xml 中移除 selectNotRunning 查询中的 limit 1条件
This commit is contained in:
2025-09-09 10:57:56 +08:00
parent 5426f61328
commit aa683a62c4
2 changed files with 1 additions and 2 deletions

View File

@@ -201,7 +201,7 @@ public class TaskTaskServiceImpl implements TaskService {
taskList = _taskList.stream().filter(task -> {
boolean workerSelfHostedScenic = isWorkerSelfHostedScenic(task.getScenicId());
return !workerSelfHostedScenic;
}).toList();
}).limit(1).toList();
}
resp.setTasks(taskList);
resp.setTemplates(updTemplateList);

View File

@@ -84,7 +84,6 @@
from task
where status = 0
and worker_id is null
limit 1
</select>
<select id="selectAllNotRunning" resultType="com.ycwl.basic.model.pc.task.entity.TaskEntity">
select *