This commit is contained in:
Xu Chang 2024-08-30 15:57:06 +08:00
commit 23136ef665
4 changed files with 21 additions and 18 deletions

View File

@ -107,14 +107,15 @@ export class SubScriber extends Feature {
let count = 0;
socket.on('connect_error', async () => {
count++;
if (count > 10) {
if (count > 50) {
// 可能socket地址改变了刷新重连
socket.removeAllListeners();
socket.disconnect();
this.url = undefined;
await this.connect();
resolve(undefined);
}
socket.removeAllListeners();
socket.disconnect();
this.socket = null;
await this.connect();
resolve(undefined);
});
}
socket.connect();

View File

@ -111,14 +111,15 @@ class SubScriber extends Feature_1.Feature {
let count = 0;
socket.on('connect_error', async () => {
count++;
if (count > 10) {
if (count > 50) {
// 可能socket地址改变了刷新重连
socket.removeAllListeners();
socket.disconnect();
this.url = undefined;
await this.connect();
resolve(undefined);
}
socket.removeAllListeners();
socket.disconnect();
this.socket = null;
await this.connect();
resolve(undefined);
});
}
socket.connect();

View File

@ -1,6 +1,6 @@
{
"name": "oak-frontend-base",
"version": "5.3.4",
"version": "5.3.5",
"description": "oak框架中前端与业务逻辑无关的平台部分",
"author": {
"name": "XuChang"
@ -24,7 +24,7 @@
"node-schedule": "^2.1.1",
"nprogress": "^0.2.0",
"oak-common-aspect": "~3.0.0",
"oak-domain": "~5.0.19",
"oak-domain": "~5.0.20",
"oak-memory-tree-store": "~3.3.1",
"ol": "^7.3.0",
"react-activation": "^0.12.4",

View File

@ -148,16 +148,17 @@ export class SubScriber<ED extends EntityDict & BaseEntityDict> extends Feature
if (!optionInited) {
let count = 0;
socket.on('connect_error', async () => {
socket.on('connect_error', async (err) => {
count++;
if (count > 10) {
if (count > 50) {
// 可能socket地址改变了刷新重连
socket.removeAllListeners();
socket.disconnect();
this.url = undefined;
await this.connect();
resolve(undefined);
}
socket.removeAllListeners();
socket.disconnect();
this.url = undefined;
await this.connect();
resolve(undefined);
});
}