@seamnet/client 0.13.2 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/plugins/im/index.cjs +10 -3
- package/package.json +1 -1
package/lib/plugins/im/index.cjs
CHANGED
|
@@ -147,7 +147,7 @@ function createImPlugin() {
|
|
|
147
147
|
// 重建失败后自驱重试:指数退避 + jitter;成功后重置
|
|
148
148
|
let rebuildRetryAttempt = 0;
|
|
149
149
|
let rebuildRetryTimer = null;
|
|
150
|
-
const REBUILD_COOLDOWN_MS =
|
|
150
|
+
const REBUILD_COOLDOWN_MS = 60_000;
|
|
151
151
|
const REBUILD_DEBOUNCE_MS = 3_000;
|
|
152
152
|
const REBUILD_WATCHDOG_MS = 30_000; // 整个重建最多 30s,超时强制失败
|
|
153
153
|
const SDK_CALL_TIMEOUT_MS = 10_000; // 单个 SDK 调用超时
|
|
@@ -158,8 +158,9 @@ function createImPlugin() {
|
|
|
158
158
|
const KEEPALIVE_TIMEOUT_MS = 10_000;
|
|
159
159
|
// 重建失败退避表(最后一档持续)
|
|
160
160
|
const REBUILD_RETRY_BACKOFF_MS = [3_000, 10_000, 30_000, 60_000];
|
|
161
|
-
//
|
|
162
|
-
|
|
161
|
+
// 不再主动 rebuild 2801——SDK 内部有自己的重连,0.12.7 证明十几天不断。
|
|
162
|
+
// 0.13.0 加 rebuild 反而制造僵尸循环。只靠 keepalive(3min)和 kicked_out 兜底。
|
|
163
|
+
const SDK_REBUILD_ERROR_CODES = new Set();
|
|
163
164
|
|
|
164
165
|
function withTimeout(promise, ms, name) {
|
|
165
166
|
let tid = null;
|
|
@@ -769,6 +770,12 @@ function createImPlugin() {
|
|
|
769
770
|
processRejectionHandler = (reason) => {
|
|
770
771
|
const code = reason?.code;
|
|
771
772
|
if (code && SDK_REBUILD_ERROR_CODES.has(code)) {
|
|
773
|
+
// sdkReady=true 说明当前 session 健康,2801 来自被 destroy 但没清干净的老实例
|
|
774
|
+
// 真正断了会被 keepalive(3min)或 onSdkError(generation-scoped)兜住
|
|
775
|
+
if (sdkReady) {
|
|
776
|
+
log.info('stale_rejection_ignored', { code });
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
772
779
|
scheduleRebuild(`unhandledRejection:${code}`);
|
|
773
780
|
}
|
|
774
781
|
};
|