refactor(接口测试): WebSocket增加定时心跳检查防止超时
--bug=1018491 --user=赵勇 【接口测试】github#18046,接口自动化,在导入的接口,配置“前置操作--等待控制器”时间设置为5分钟,“调试”接口最后没显示执行结果 https://www.tapd.cn/55049933/s/1325162
This commit is contained in:
parent
0e2ce21192
commit
d4d9bc4d16
|
@ -1,10 +1,11 @@
|
|||
package io.metersphere.websocket;
|
||||
|
||||
import io.metersphere.commons.utils.JSON;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import io.metersphere.api.dto.MsgDTO;
|
||||
import io.metersphere.commons.utils.JSON;
|
||||
import io.metersphere.commons.utils.WebSocketUtil;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.websocket.*;
|
||||
|
@ -60,4 +61,12 @@ public class IndexWebSocket {
|
|||
public void onError(Session session, Throwable throwable) throws IOException {
|
||||
session.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* 每一分钟群发一次心跳检查
|
||||
*/
|
||||
@Scheduled(cron = "0 0/1 * * * ?")
|
||||
public void heartbeatCheck() {
|
||||
WebSocketUtil.sendMessageAll("heartbeat check");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue