mirror of
https://github.com/open-webui/open-webui
synced 2025-06-22 18:07:17 +00:00
Change default db pooling
This commit is contained in:
parent
7513dc7e34
commit
63d99abf41
@ -272,15 +272,13 @@ if "postgres://" in DATABASE_URL:
|
|||||||
|
|
||||||
DATABASE_SCHEMA = os.environ.get("DATABASE_SCHEMA", None)
|
DATABASE_SCHEMA = os.environ.get("DATABASE_SCHEMA", None)
|
||||||
|
|
||||||
DATABASE_POOL_SIZE = os.environ.get("DATABASE_POOL_SIZE", 0)
|
DATABASE_POOL_SIZE = os.environ.get("DATABASE_POOL_SIZE", None)
|
||||||
|
|
||||||
if DATABASE_POOL_SIZE == "":
|
if DATABASE_POOL_SIZE != None:
|
||||||
DATABASE_POOL_SIZE = 0
|
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
DATABASE_POOL_SIZE = int(DATABASE_POOL_SIZE)
|
DATABASE_POOL_SIZE = int(DATABASE_POOL_SIZE)
|
||||||
except Exception:
|
except Exception:
|
||||||
DATABASE_POOL_SIZE = 0
|
DATABASE_POOL_SIZE = None
|
||||||
|
|
||||||
DATABASE_POOL_MAX_OVERFLOW = os.environ.get("DATABASE_POOL_MAX_OVERFLOW", 0)
|
DATABASE_POOL_MAX_OVERFLOW = os.environ.get("DATABASE_POOL_MAX_OVERFLOW", 0)
|
||||||
|
|
||||||
|
@ -94,10 +94,14 @@ else:
|
|||||||
pool_pre_ping=True,
|
pool_pre_ping=True,
|
||||||
poolclass=QueuePool,
|
poolclass=QueuePool,
|
||||||
)
|
)
|
||||||
else:
|
elif DATABASE_POOL_SIZE == 0:
|
||||||
engine = create_engine(
|
engine = create_engine(
|
||||||
SQLALCHEMY_DATABASE_URL, pool_pre_ping=True, poolclass=NullPool
|
SQLALCHEMY_DATABASE_URL, pool_pre_ping=True, poolclass=NullPool
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
engine = create_engine(
|
||||||
|
SQLALCHEMY_DATABASE_URL, pool_pre_ping=True
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
SessionLocal = sessionmaker(
|
SessionLocal = sessionmaker(
|
||||||
|
Loading…
Reference in New Issue
Block a user