Skip to content

Commit

Permalink
fix: sqlite3 lockout timeout (#3463)
Browse files Browse the repository at this point in the history
sqlite3 lockout timeout
  • Loading branch information
zzzming authored and anovazzi1 committed Aug 21, 2024
1 parent 00ad228 commit 0df5877
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backend/base/langflow/services/database/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def _create_engine(self) -> "Engine":
if self.settings_service.settings.database_url and self.settings_service.settings.database_url.startswith(
"sqlite"
):
connect_args = {"check_same_thread": False}
connect_args = {
"check_same_thread": False,
"timeout": self.settings_service.settings.db_connect_timeout,
}
else:
connect_args = {}
try:
Expand Down
2 changes: 2 additions & 0 deletions src/backend/base/langflow/services/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class Settings(BaseSettings):
max_overflow: int = 20
"""The number of connections to allow that can be opened beyond the pool size.
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_pragmas: Optional[dict] = {"synchronous": "NORMAL", "journal_mode": "WAL"}
Expand Down

0 comments on commit 0df5877

Please sign in to comment.