From 08cf3f66ffbc0be3f5e95960454194d637b91e71 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Tue, 23 Jun 2026 20:35:50 +0800
Subject: [PATCH] fix(gateApi): 修正网格重启跨度配置
---
src/main/java/com/xcong/excoin/modules/gateApi/GateKlineWebSocketClient.java | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/GateKlineWebSocketClient.java b/src/main/java/com/xcong/excoin/modules/gateApi/GateKlineWebSocketClient.java
index d4cec97..811bb20 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateKlineWebSocketClient.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateKlineWebSocketClient.java
@@ -85,6 +85,9 @@
return t;
});
+ /**
+ * @param wsUrl Gate WebSocket 地址(由 {@link GateConfig#getWsUrl()} 提供)
+ */
public GateKlineWebSocketClient(String wsUrl) {
this.wsUrl = wsUrl;
}
@@ -229,6 +232,7 @@
isConnected.set(false);
}
};
+ webSocketClient.setConnectionLostTimeout(0);
webSocketClient.connect();
} catch (URISyntaxException e) {
log.error("[WS] URI格式错误", e);
@@ -254,6 +258,12 @@
}
if ("subscribe".equals(event)) {
log.info("[WS] {} 订阅成功: {}", channel, response.getJSONObject("result"));
+ for (GateChannelHandler handler : channelHandlers) {
+ if (channel.equals(handler.getChannelName())) {
+ handler.setSubscribed(true);
+ break;
+ }
+ }
return;
}
if ("unsubscribe".equals(event)) {
@@ -278,6 +288,17 @@
}
}
+ /**
+ * 检查所有已注册的频道是否都已收到订阅成功确认。
+ */
+ public boolean areAllSubscribed() {
+ if (channelHandlers.isEmpty()) return false;
+ for (GateChannelHandler h : channelHandlers) {
+ if (!h.isSubscribed()) return false;
+ }
+ return true;
+ }
+
// ---- heartbeat ----
/**
--
Gitblit v1.9.1