Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
5c655f29
Unverified
Commit
5c655f29
authored
Jun 17, 2024
by
perf3ct
Browse files
stop even using pooled DBs in peewee
parent
981866eb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
16 deletions
+4
-16
backend/apps/webui/internal/wrappers.py
backend/apps/webui/internal/wrappers.py
+4
-16
No files found.
backend/apps/webui/internal/wrappers.py
View file @
5c655f29
...
@@ -22,23 +22,11 @@ class PeeweeConnectionState(object):
...
@@ -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
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment