From 7e6e0f806b7a1f3258655186f4d7be875fc35c23 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Thu, 16 Oct 2025 11:00:52 +0800 Subject: [PATCH] enable sqlite WAL mode --- .gitignore | 2 ++ routstr/core/db.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index ff38fa90..b643d7da 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,8 @@ dist/ # Development .notes .*keys.db +*.db-shm +*.db-wal .*wallet.sqlite3 *models.json .cashu diff --git a/routstr/core/db.py b/routstr/core/db.py index 9f886791..6bc3bd90 100644 --- a/routstr/core/db.py +++ b/routstr/core/db.py @@ -79,6 +79,8 @@ async def balances_for_mint_and_unit( async def init_db() -> None: """Initializes the database and creates tables if they don't exist.""" async with engine.begin() as conn: + if DATABASE_URL.startswith("sqlite"): + await conn.exec_driver_sql("PRAGMA journal_mode=WAL") await conn.run_sync(SQLModel.metadata.create_all)