fix(connection): stop background search auto-reconnect

This commit is contained in:
zhangyc authored and GitHub committed 2026-09-09 22:36:13 +08:00
1 parent a9ec07e651
commit 2b26bd6a1a
2 files changed
+100

No files matched your search

@@ -4093,12 +4093,16 @@ export const useConnectionStore = defineStore("connection", () => {
// a health probe makes an otherwise local tab switch take up to 5s.
if (options.verifyHealth === false) return;
if (hasRecentConnectionHealthCheck(connectionId)) return;
const stateRevision = connectionStateRevision(connectionId);
// Optimistic: verify backend pool is actually healthy
try {
await withConnectionHealthTimeout(connectionId, api.checkConnectionHealth(connectionId));
if (!isCurrentConnectionStateRevision(connectionId, stateRevision)) throw new Error(CONNECTION_ATTEMPT_CANCELLED_MESSAGE);
markConnectionHealthChecked(connectionId);
return;
} catch {
// A late probe must not undo an explicit disconnect or a newer reconnect.
if (!isCurrentConnectionStateRevision(connectionId, stateRevision)) throw new Error(CONNECTION_ATTEMPT_CANCELLED_MESSAGE);
// Backend pool is dead — remove from connectedIds and reconnect.
// 死池重连同样跨越了连接生命周期:shared 表元数据缓存与数据标签页的
// 元数据 freshness 都必须作废,否则自动重连后仍可能复用断链前的旧
@@ -5694,6 +5698,8 @@ export const useConnectionStore = defineStore("connection", () => {
}
async function loadObjectGroupChildren(node: TreeNode, options?: LoadTreeOptions) {
// Queued search/refresh tasks can outlive disconnect, which removes their nodes.
if (!treeNodeInSidebarTree(node)) return;
const packageOwnerId = packageMemberGroupOwnerId(node);
const packageConfig = node.connectionId ? getConfig(node.connectionId) : undefined;
if (packageOwnerId && effectiveDatabaseTypeForConnection(packageConfig) === "xugu") {