parent
29c3325036
commit
ae99e6927e
2 changed files with 6 additions and 1 deletions
|
|
@ -50,7 +50,10 @@ class DatabaseService(Service):
|
||||||
if self.settings_service.settings.database_url and self.settings_service.settings.database_url.startswith(
|
if self.settings_service.settings.database_url and self.settings_service.settings.database_url.startswith(
|
||||||
"sqlite"
|
"sqlite"
|
||||||
):
|
):
|
||||||
connect_args = {"check_same_thread": False}
|
connect_args = {
|
||||||
|
"check_same_thread": False,
|
||||||
|
"timeout": self.settings_service.settings.db_connect_timeout,
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
connect_args = {}
|
connect_args = {}
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,8 @@ class Settings(BaseSettings):
|
||||||
max_overflow: int = 20
|
max_overflow: int = 20
|
||||||
"""The number of connections to allow that can be opened beyond the pool size.
|
"""The number of connections to allow that can be opened beyond the pool size.
|
||||||
If not provided, the default is 20."""
|
If not provided, the default is 20."""
|
||||||
|
db_connect_timeout: int = 20
|
||||||
|
"""The number of seconds to wait before giving up on a lock to released or establishing a connection to the database."""
|
||||||
|
|
||||||
# sqlite configuration
|
# sqlite configuration
|
||||||
sqlite_pragmas: Optional[dict] = {"synchronous": "NORMAL", "journal_mode": "WAL"}
|
sqlite_pragmas: Optional[dict] = {"synchronous": "NORMAL", "journal_mode": "WAL"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue