Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(app): retry connection list loading at startup

Jinpy397bff26c842
diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue
index a6c9cd7d0c..e8170d6821 100644
--- a/apps/desktop/src/App.vue
+++ b/apps/desktop/src/App.vue
@@ -4071,7 +4071,22 @@ async function initApp() {
await settingsStore.initEditorSettings();
markStartupPhase("settings-ready");
console.log(`[STARTUP] settingsStore.initEditorSettings: ${(performance.now() - t0).toFixed(0)}ms`);
- await connectionStore.initFromDisk();
+ // 连接列表加载是启动链路的单点:这里的一次瞬态失败(web/docker 下偶发,
+ // 如认证握手期间的一次请求失败)会被外层 catch 收成一个一闪而过的 toast,
+ // 应用随后以空连接列表运行,除整页 reload 外没有任何恢复入口。有界重试
+ // 吸收瞬态失败;重试耗尽才交给外层 toast(认证类失败重试也无济于事,
+ // 行为不劣于现状)。
+ const connectionLoadAttempts = 3;
+ for (let attempt = 1; ; attempt += 1) {
+ try {
+ await connectionStore.initFromDisk();
+ break;
+ } catch (error) {
+ if (attempt >= connectionLoadAttempts) throw error;
+ console.warn(`[STARTUP] connectionStore.initFromDisk failed (attempt ${attempt}/${connectionLoadAttempts}), retrying`, error);
+ await new Promise((resolve) => setTimeout(resolve, 300 * attempt));
+ }
+ }
markStartupPhase("connections-ready");
console.log(`[STARTUP] connectionStore.initFromDisk: ${(performance.now() - t0).toFixed(0)}ms`);
await queryStore.initOpenTabs({ validConnectionIds: connectionStore.connections.map((connection) => connection.id) });