File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ class MachineConfig(BaseModel):
3838 allow_removal : bool = False
3939 modular_spa : bool = False
4040 processing_enabled : bool = True
41+ sqlalchemy_pooling : bool = True
4142 machine_override : str = ""
4243 processed_extra_directory : str = ""
4344 plugin_packages : Dict [str , Path ] = {}
Original file line number Diff line number Diff line change 55import yaml
66from cryptography .fernet import Fernet
77from fastapi import Depends
8+ from sqlalchemy .pool import NullPool
89from sqlmodel import Session , create_engine
910
1011from murfey .server .config import MachineConfig , get_machine_config
@@ -23,7 +24,10 @@ def get_murfey_db_session(
2324 machine_config : MachineConfig | None = None ,
2425) -> Session :
2526 _url = url (machine_config )
26- engine = create_engine (_url )
27+ if machine_config and not machine_config .sqlalchemy_pooling :
28+ engine = create_engine (_url , poolclass = NullPool )
29+ else :
30+ engine = create_engine (_url )
2731 with Session (engine ) as session :
2832 try :
2933 yield session
You can’t perform that action at this time.
0 commit comments