Increase database connection pool limits for large printer farms

QueuePool exhaustion at 100+ printers. Bumped pool_size 10→20,
  max_overflow 20→200, and SQLite busy_timeout 5s→15s.
This commit is contained in:
maziggy
2026-03-25 08:20:22 +01:00
parent 95c703282d
commit b8fa2df36d
2 changed files with 6 additions and 5 deletions
+5 -5
View File
@@ -12,7 +12,7 @@ def _set_sqlite_pragmas(dbapi_conn, connection_record):
# WAL mode allows concurrent readers + one writer (vs default DELETE mode which locks entirely)
cursor.execute("PRAGMA journal_mode = WAL")
# Wait up to 5 seconds when the database is locked instead of failing immediately
cursor.execute("PRAGMA busy_timeout = 5000")
cursor.execute("PRAGMA busy_timeout = 15000")
cursor.execute("PRAGMA synchronous = NORMAL")
cursor.close()
@@ -20,8 +20,8 @@ def _set_sqlite_pragmas(dbapi_conn, connection_record):
engine = create_async_engine(
settings.database_url,
echo=settings.debug,
pool_size=10,
max_overflow=20,
pool_size=20,
max_overflow=200,
)
# Register the pragma listener on the underlying sync engine
@@ -46,8 +46,8 @@ async def reinitialize_database():
engine = create_async_engine(
settings.database_url,
echo=settings.debug,
pool_size=10,
max_overflow=20,
pool_size=20,
max_overflow=200,
)
event.listen(engine.sync_engine, "connect", _set_sqlite_pragmas)
async_session = async_sessionmaker(