fix: 调整为30分钟查询一次,并且前端取消自动查询最新数据
This commit is contained in:
parent
5dceec6d38
commit
0ba3f638f4
@ -99,9 +99,9 @@ func handleConnection(conn net.Conn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendPeriodicCommand 每10秒发送一次查询指令
|
// sendPeriodicCommand 每30分钟发送一次查询指令
|
||||||
func sendPeriodicCommand(conn net.Conn, remoteAddr string) {
|
func sendPeriodicCommand(conn net.Conn, remoteAddr string) {
|
||||||
ticker := time.NewTicker(10 * time.Second)
|
ticker := time.NewTicker(30 * time.Minute)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|||||||
@ -275,9 +275,6 @@
|
|||||||
// 检查连接状态
|
// 检查连接状态
|
||||||
checkConnectionStatus();
|
checkConnectionStatus();
|
||||||
connectionCheckTimer = setInterval(checkConnectionStatus, 30000); // 每30秒检查一次
|
connectionCheckTimer = setInterval(checkConnectionStatus, 30000); // 每30秒检查一次
|
||||||
|
|
||||||
// 获取最新数据显示
|
|
||||||
fetchLatestData();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 初始化日期选择器
|
// 初始化日期选择器
|
||||||
@ -784,7 +781,10 @@
|
|||||||
latestDataElement.style.opacity = 0.5;
|
latestDataElement.style.opacity = 0.5;
|
||||||
document.getElementById('queryLatestBtn').textContent = '查询中...';
|
document.getElementById('queryLatestBtn').textContent = '查询中...';
|
||||||
|
|
||||||
// 这里会触发TCP服务器发送查询指令,等待3秒后获取最新数据
|
// 先获取一次当前最新数据
|
||||||
|
fetchLatestData();
|
||||||
|
|
||||||
|
// 触发TCP服务器发送查询指令,等待3秒后再次获取最新数据
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
fetchLatestData();
|
fetchLatestData();
|
||||||
loadData(); // 也刷新一下表格数据
|
loadData(); // 也刷新一下表格数据
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user