refactor(性能测试): 每天定时清理已经执行完成的测试中间数据
This commit is contained in:
parent
aadf243399
commit
592b2a7cd0
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.performance.job;
|
package io.metersphere.performance.job;
|
||||||
|
|
||||||
import com.fit2cloud.quartz.anno.QuartzScheduled;
|
import com.fit2cloud.quartz.anno.QuartzScheduled;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.LoadTestReport;
|
import io.metersphere.base.domain.LoadTestReport;
|
||||||
import io.metersphere.base.domain.LoadTestReportDetailExample;
|
import io.metersphere.base.domain.LoadTestReportDetailExample;
|
||||||
import io.metersphere.base.domain.LoadTestReportExample;
|
import io.metersphere.base.domain.LoadTestReportExample;
|
||||||
|
@ -26,6 +27,9 @@ public class LoadTestReportDetailCleanJob {
|
||||||
public void cleanCompletedTestDetail() {
|
public void cleanCompletedTestDetail() {
|
||||||
LoadTestReportExample example = new LoadTestReportExample();
|
LoadTestReportExample example = new LoadTestReportExample();
|
||||||
example.createCriteria().andStatusEqualTo(PerformanceTestStatus.Completed.name());
|
example.createCriteria().andStatusEqualTo(PerformanceTestStatus.Completed.name());
|
||||||
|
long count = loadTestReportMapper.countByExample(example);
|
||||||
|
for (int i = 0; i < count / 10; i++) {
|
||||||
|
PageHelper.startPage(i, 10);
|
||||||
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(example);
|
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(example);
|
||||||
loadTestReports.forEach(report -> {
|
loadTestReports.forEach(report -> {
|
||||||
// 清理文件
|
// 清理文件
|
||||||
|
@ -35,3 +39,4 @@ public class LoadTestReportDetailCleanJob {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue