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
ad32a2ef
Commit
ad32a2ef
authored
May 31, 2024
by
Беклемишев Петр Алексеевич
Browse files
Drop mysql restarts
parent
e59e1f50
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
13 deletions
+3
-13
backend/apps/webui/internal/wrappers.py
backend/apps/webui/internal/wrappers.py
+3
-13
No files found.
backend/apps/webui/internal/wrappers.py
View file @
ad32a2ef
from
contextvars
import
ContextVar
from
peewee
import
PostgresqlDatabase
,
InterfaceError
as
PeeWeeInterfaceError
,
MySQLDatabase
,
_ConnectionState
from
peewee
import
PostgresqlDatabase
,
InterfaceError
as
PeeWeeInterfaceError
,
_ConnectionState
from
playhouse.db_url
import
register_database
from
playhouse.pool
import
PooledPostgresqlDatabase
,
PooledMySQLDatabase
from
playhouse.pool
import
PooledPostgresqlDatabase
from
playhouse.shortcuts
import
ReconnectMixin
from
psycopg2
import
OperationalError
from
psycopg2.errors
import
InterfaceError
...
...
@@ -26,7 +26,7 @@ class PeeweeConnectionState(_ConnectionState):
class
CustomReconnectMixin
(
ReconnectMixin
):
reconnect_errors
=
(
# default ReconnectMixin exceptions
(MySQL specific)
# default ReconnectMixin exceptions
*
ReconnectMixin
.
reconnect_errors
,
# psycopg2
(
OperationalError
,
'termin'
),
...
...
@@ -44,16 +44,6 @@ class ReconnectingPooledPostgresqlDatabase(CustomReconnectMixin, PooledPostgresq
pass
class
ReconnectingMySQLDatabase
(
CustomReconnectMixin
,
MySQLDatabase
):
pass
class
ReconnectingPooledMySQLDatabase
(
CustomReconnectMixin
,
PooledMySQLDatabase
):
pass
def
register_peewee_databases
():
register_database
(
MySQLDatabase
,
'mysql'
)
register_database
(
PooledMySQLDatabase
,
'mysql+pool'
)
register_database
(
ReconnectingPostgresqlDatabase
,
'postgres'
,
'postgresql'
)
register_database
(
ReconnectingPooledPostgresqlDatabase
,
'postgres+pool'
,
'postgresql+pool'
)
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