fix: [30388f42] Optimiere SQLite Config für Synology/Docker (Fix ROLLBACKs)
- Setzt PRAGMA synchronous=NORMAL und PRAGMA mmap_size=0. - Deaktiviert Memory Mapping, da dies auf Docker-Volumes (Synology) oft zu I/O-Fehlern und fehlgeschlagenen Commits führt. - Soll die mysteriösen ROLLBACKs im Company Explorer beheben.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user