Skip to content

Commit 4a8924b

Browse files
committed
fix: enable sqlite wal mode and default rate limit
1 parent 0eddf4c commit 4a8924b

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

cashu/core/db.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,11 @@ def _set_sqlite_pragma(dbapi_connection, connection_record):
151151
try:
152152
cursor = dbapi_connection.cursor()
153153
cursor.execute("PRAGMA foreign_keys=ON;")
154+
cursor.execute("PRAGMA journal_mode=WAL;")
155+
cursor.execute("PRAGMA busy_timeout=5000;")
154156
cursor.close()
155157
except Exception as e:
156-
logger.warning(f"Could not enable SQLite PRAGMA foreign_keys: {e}")
158+
logger.warning(f"Could not enable SQLite PRAGMAs: {e}")
157159

158160
self.async_session = sessionmaker(
159161
self.engine, # type: ignore

cashu/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class MintBackends(MintSettings):
107107

108108
class MintLimits(MintSettings):
109109
mint_rate_limit: bool = Field(
110-
default=False, title="Rate limit", description="IP-based rate limiter."
110+
default=True, title="Rate limit", description="IP-based rate limiter."
111111
)
112112
mint_global_rate_limit_per_minute: int = Field(
113113
default=60,

0 commit comments

Comments
 (0)