mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 13:40:55 +00:00
stop even using pooled DBs in peewee
This commit is contained in:
parent
981866eb93
commit
5c655f298b
@ -22,23 +22,11 @@ class PeeweeConnectionState(object):
|
|||||||
def register_connection(db_url):
|
def register_connection(db_url):
|
||||||
db = connect(db_url)
|
db = connect(db_url)
|
||||||
if isinstance(db, PostgresqlDatabase):
|
if isinstance(db, PostgresqlDatabase):
|
||||||
db = PooledPostgresqlExtDatabase(
|
# Directly use PostgresqlDatabase without pooling
|
||||||
db.database,
|
db.autoconnect = True
|
||||||
max_connections=8,
|
|
||||||
stale_timeout=300,
|
|
||||||
timeout=None,
|
|
||||||
autoconnect=True,
|
|
||||||
**db.connect_params
|
|
||||||
)
|
|
||||||
elif isinstance(db, SqliteDatabase):
|
elif isinstance(db, SqliteDatabase):
|
||||||
db = PooledSqliteDatabase(
|
# Directly use SqliteDatabase without pooling
|
||||||
db.database,
|
db.autoconnect = True
|
||||||
max_connections=8,
|
|
||||||
stale_timeout=300,
|
|
||||||
timeout=None,
|
|
||||||
autoconnect=True,
|
|
||||||
**db.connect_params
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
raise ValueError('Unsupported database connection')
|
raise ValueError('Unsupported database connection')
|
||||||
return db
|
return db
|
Loading…
Reference in New Issue
Block a user