fix(任务中心): 优化任务中心同步频率,当关闭窗口后停止关闭检测

This commit is contained in:
fit2-zhao 2021-07-23 19:14:13 +08:00 committed by fit2-zhao
parent 77c2132245
commit 4fd31e7e74
2 changed files with 11 additions and 7 deletions

View File

@ -33,7 +33,7 @@ public class ApiReportWebSocket {
public void onOpen(@PathParam("reportId") String reportId, @PathParam("runMode") String runMode, Session session) { public void onOpen(@PathParam("reportId") String reportId, @PathParam("runMode") String runMode, Session session) {
Timer timer = new Timer(true); Timer timer = new Timer(true);
ApiReportTask task = new ApiReportTask(session, reportId, runMode); ApiReportTask task = new ApiReportTask(session, reportId, runMode);
timer.schedule(task, 0, 1000); timer.schedule(task, 0, 3 * 1000);
refreshTasks.putIfAbsent(session, timer); refreshTasks.putIfAbsent(session, timer);
} }

View File

@ -137,6 +137,7 @@ export default {
], ],
condition: {triggerMode: "", executionStatus: ""}, condition: {triggerMode: "", executionStatus: ""},
maintainerOptions: [], maintainerOptions: [],
websocket:Object,
}; };
}, },
props: { props: {
@ -144,9 +145,15 @@ export default {
}, },
created() { created() {
if (hasPermissions('PROJECT_API_SCENARIO:READ')) { if (hasPermissions('PROJECT_API_SCENARIO:READ')) {
this.getTaskRunning();
this.condition.executor = getCurrentUser().id; this.condition.executor = getCurrentUser().id;
} }
},
watch: {
taskVisible(v){
if(!v){
this.close();
}
}
}, },
methods: { methods: {
format(item) { format(item) {
@ -186,10 +193,6 @@ export default {
} }
}, },
onClose(e) { onClose(e) {
if (e.code === 1005) {
// socketreport
return;
}
}, },
showTaskCenter() { showTaskCenter() {
this.getTaskRunning(); this.getTaskRunning();
@ -200,6 +203,7 @@ export default {
close() { close() {
this.visible = false; this.visible = false;
this.taskVisible = false; this.taskVisible = false;
this.websocket.close();
}, },
open() { open() {
this.showTaskCenter(); this.showTaskCenter();