fix: 拓扑状态刷新定时器改调度器
This commit is contained in:
@@ -328,16 +328,18 @@ function fnGraphDataLoad(reload: boolean = false) {
|
||||
} else {
|
||||
handleRanderGraph(graphG6Dom.value, graphState.data);
|
||||
}
|
||||
fnGetState(); // 获取网元状态
|
||||
fnGetState();
|
||||
interval10s.value = setInterval(() => {
|
||||
fnGetState(); // 获取网元状态
|
||||
}, 10_000);
|
||||
});
|
||||
}
|
||||
|
||||
/**网元状态定时器 */
|
||||
const stateTimeout = ref<any>(null);
|
||||
/**网元状态调度器 */
|
||||
const interval10s = ref<any>(null);
|
||||
|
||||
/**查询网元状态 */
|
||||
async function fnGetState() {
|
||||
clearTimeout(stateTimeout.value);
|
||||
// 获取节点状态
|
||||
for (const node of graphState.data.nodes) {
|
||||
if (notNeNodes.includes(node.id)) continue;
|
||||
@@ -352,8 +354,6 @@ async function fnGetState() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
stateTimeout.value = setTimeout(() => fnGetState(), 30_000);
|
||||
}
|
||||
|
||||
/**接收数据后回调 */
|
||||
@@ -472,7 +472,7 @@ onMounted(() => {
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
ws.close();
|
||||
clearTimeout(stateTimeout.value);
|
||||
clearInterval(interval10s.value);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user