Browse Source

报警重连以后等一分钟再读报警列表

menglu 3 years ago
parent
commit
0e5adac4b3

+ 7 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/websocket/AlarmWebSocketClient.java

@@ -17,6 +17,7 @@ import lombok.extern.slf4j.Slf4j;
 @Slf4j
 public class AlarmWebSocketClient extends WebSocketClient {
 	public static AlarmWebSocketClient client;
+	public static boolean has_close = false;
 
 	public URI serverUri;
 
@@ -34,6 +35,11 @@ public class AlarmWebSocketClient extends WebSocketClient {
 				@Override
 				public void run() {
 					try {
+						if (has_close) {
+							log.warn("onOpen refresh wait begin");
+							Thread.sleep(1000L * 60);
+							log.warn("onOpen refresh wait end");
+						}
 						log.warn("onOpen refresh begin");
 						JSONObject AlarmJob = new JSONObject();
 						AlarmJob.put("type", "refresh");
@@ -61,6 +67,7 @@ public class AlarmWebSocketClient extends WebSocketClient {
 	@Override
 	public void onClose(int arg0, String arg1, boolean arg2) {
 		log.warn("onClose: " + serverUri.toString());
+		has_close = true;
 		// this.close_connect();
 	}