From de8b3f08402ca842ac9eb2a69fd74c18b12015e4 Mon Sep 17 00:00:00 2001 From: hengyan <2653631564@qq.com> Date: Tue, 21 Jul 2026 17:42:40 +0800 Subject: [PATCH] fix: sqlite cross-thread access --- app/storage/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/storage/db.py b/app/storage/db.py index 8bee020..605900d 100644 --- a/app/storage/db.py +++ b/app/storage/db.py @@ -10,7 +10,7 @@ def connect(db_path: str) -> sqlite3.Connection: parent = os.path.dirname(os.path.abspath(db_path)) if parent and not os.path.exists(parent): os.makedirs(parent, exist_ok=True) - conn = sqlite3.connect(db_path, timeout=30) + conn = sqlite3.connect(db_path, timeout=30, check_same_thread=False) conn.row_factory = sqlite3.Row conn.execute("PRAGMA journal_mode=WAL") conn.execute("PRAGMA busy_timeout=30000")