From 974b07fdcc1feffb732c92aeab55953cad0b7f72 Mon Sep 17 00:00:00 2001 From: an-lee Date: Sun, 8 Sep 2024 21:53:35 +0800 Subject: [PATCH] fix db connection --- enjoy/src/main/db/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/enjoy/src/main/db/index.ts b/enjoy/src/main/db/index.ts index f972d656..1efc47d8 100644 --- a/enjoy/src/main/db/index.ts +++ b/enjoy/src/main/db/index.ts @@ -216,6 +216,13 @@ db.disconnect = async () => { db.registerIpcHandlers = () => { ipcMain.handle("db-connect", async () => { + if (db.isConnecting) + return { + state: "connecting", + path: settings.dbPath(), + error: null, + }; + try { await db.connect(); return {