Skip to content

Commit

Permalink
refactor(测试计划): 定时清理无效队列数据
Browse files Browse the repository at this point in the history
  • Loading branch information
fit2-zhao committed May 15, 2023
1 parent 4fc8c84 commit 32f2368
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -533,5 +533,9 @@ public void deleteQueue() {

ApiExecutionQueueDetailExample detailExample = new ApiExecutionQueueDetailExample();
executionQueueDetailMapper.deleteByExample(detailExample);

extApiScenarioReportMapper.updateByRunning();

extApiDefinitionExecResultMapper.updateByRunning();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ public interface ExtApiDefinitionExecResultMapper {
List<String> selectDistinctStatusByReportId(String reportId);

List<String> selectByProjectIdAndLessThanTime(@Param("projectId") String projectId, @Param("time") long time);

void updateByRunning();
}
Original file line number Diff line number Diff line change
Expand Up @@ -484,4 +484,8 @@
select id from api_definition_exec_result where project_id = #{projectId} and create_time &lt; #{time}
</select>

<update id="updateByRunning" parameterType="java.util.List">
update api_definition_exec_result set `status`= "STOP" where `status` ="Running"
</update>

</mapper>
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
FROM
api_execution_queue
WHERE
report_id != NULL
AND run_mode IN ( 'API_PLAN', 'JENKINS_SCENARIO_PLAN', 'SCHEDULE_SCENARIO_PLAN' )
run_mode IN ( 'API_PLAN', 'JENKINS_SCENARIO_PLAN', 'SCHEDULE_SCENARIO_PLAN' )
AND id NOT IN ( SELECT t1.queue_id FROM api_execution_queue_detail t1 )
AND report_id NOT IN ( SELECT report_id FROM test_plan_execution_queue );
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ public interface ExtApiScenarioReportMapper {
List<ApiScenarioReport> findByProjectIds(@Param("request") TaskCenterRequest request);

List<String> selectByProjectIdAndLessThanTime(@Param("projectId") String projectId, @Param("time") long time);

void updateByRunning();
}
Original file line number Diff line number Diff line change
Expand Up @@ -468,4 +468,8 @@
select id from api_scenario_report where create_time &lt; #{time} and project_id = #{projectId}
</select>

<update id="updateByRunning">
update api_scenario_report set `status`= "STOP" where `status` ="Running"
</update>

</mapper>

0 comments on commit 32f2368

Please sign in to comment.