Commit 330fff0f by pye52

心跳调整为10分钟一次

parent 83dfa9b5
...@@ -38,7 +38,8 @@ import static com.bgycc.smartcanteen.utils.SmartCanteenUtils.TAG; ...@@ -38,7 +38,8 @@ import static com.bgycc.smartcanteen.utils.SmartCanteenUtils.TAG;
* 链接断开后自动进行重连尝试 <br/> * 链接断开后自动进行重连尝试 <br/>
*/ */
public class SCWebSocketClient extends WebSocketClient { public class SCWebSocketClient extends WebSocketClient {
private static final long HEARTBEAT_INTERVAL = 3 * 60 * 1000; private static final long FIRST_HEARTBEAT_DELAY = 20 * 1000;
private static final long HEARTBEAT_INTERVAL = 10 * 60 * 1000;
private static final long RECONNECT_DELAY = 5 * 1000; private static final long RECONNECT_DELAY = 5 * 1000;
private static final long SWITCH_INTERVAL = 10 * 1000; private static final long SWITCH_INTERVAL = 10 * 1000;
...@@ -106,7 +107,7 @@ public class SCWebSocketClient extends WebSocketClient { ...@@ -106,7 +107,7 @@ public class SCWebSocketClient extends WebSocketClient {
// 启动定时任务,轮询发送心跳包 // 启动定时任务,轮询发送心跳包
stopHeartbeat(); stopHeartbeat();
heartbeatFuture = SCTaskExecutor.getInstance() heartbeatFuture = SCTaskExecutor.getInstance()
.scheduleAtFixedRate(heartbeat, HEARTBEAT_INTERVAL, HEARTBEAT_INTERVAL, TimeUnit.MILLISECONDS); .scheduleAtFixedRate(heartbeat, FIRST_HEARTBEAT_DELAY, HEARTBEAT_INTERVAL, TimeUnit.MILLISECONDS);
LogUtils.d(TAG, "心跳任务启动"); LogUtils.d(TAG, "心跳任务启动");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment