From f2bd84af309cfb9b260d89233b481eadb32a3655 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 16 Aug 2022 18:16:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=85=A8=E9=83=A8=E6=95=B0=E6=8D=AE=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1015797 --user=王孝刚 [接口测试] github#16849接口报表-场景报告,批量删除9000条记录时,加载了十几分钟后提示删除失败 https://www.tapd.cn/55049933/s/1224560 --- .../api/service/ApiScenarioReportService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index 726f01ffcb..8ce3295e8b 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -767,7 +767,7 @@ public class ApiScenarioReportService { reportRequest.setIds(myList); //为预防数量太多,调用删除方法时引起SQL过长的Bug,此处采取分批执行的方式。 //每次处理的数据数量 - int handleCount = 5000; + int handleCount = 2000; //每次处理的集合 while (ids.size() > handleCount) { List handleIdList = new ArrayList<>(handleCount); @@ -961,10 +961,10 @@ public class ApiScenarioReportService { if (StringUtils.isNotEmpty(dto.getRunMode()) && dto.getRunMode().startsWith("UI")) { try { errorSize = dto.getRequestResults().stream().filter(requestResult -> - StringUtils.isNotEmpty(requestResult.getResponseResult().getHeaders()) - && JSONArray.parseArray(requestResult.getResponseResult().getHeaders()).stream().filter( - r -> ((JSONObject) r).containsKey("success") && !((JSONObject) r).getBoolean("success") - ).count() > 0) + StringUtils.isNotEmpty(requestResult.getResponseResult().getHeaders()) + && JSONArray.parseArray(requestResult.getResponseResult().getHeaders()).stream().filter( + r -> ((JSONObject) r).containsKey("success") && !((JSONObject) r).getBoolean("success") + ).count() > 0) .count(); } catch (Exception e) { // UI 返回的结果在 headers 里面,格式不符合规范的直接认定结果为失败