diff --git a/company-explorer/backend/database.py b/company-explorer/backend/database.py index a78fee66..0fb57c5a 100644 --- a/company-explorer/backend/database.py +++ b/company-explorer/backend/database.py @@ -10,11 +10,13 @@ engine = create_engine( connect_args={"check_same_thread": False, "timeout": 30} ) -# Enable WAL mode for SQLite +# Enable WAL mode for SQLite with Docker/Synology optimizations @event.listens_for(engine, "connect") def set_sqlite_pragma(dbapi_connection, connection_record): cursor = dbapi_connection.cursor() cursor.execute("PRAGMA journal_mode=WAL") + cursor.execute("PRAGMA synchronous=NORMAL") # Less aggressive syncing, better for concurrent access + cursor.execute("PRAGMA mmap_size=0") # Disable mmap to fix potential Docker volume I/O errors cursor.close() SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)