Disable connection pooler if env specifies it (#2222)

This commit is contained in:
Shuchang Zheng
2025-04-23 09:33:26 +08:00
committed by GitHub
parent 19e86a197a
commit bee22e5777
2 changed files with 3 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ class Settings(BaseSettings):
DEBUG_MODE: bool = False
DATABASE_STRING: str = "postgresql+psycopg://skyvern@localhost/skyvern"
DATABASE_STATEMENT_TIMEOUT_MS: int = 60000
DISABLE_CONNECTION_POOL: bool = False
PROMPT_ACTION_HISTORY_WINDOW: int = 1
TASK_RESPONSE_ACTION_SCREENSHOT_COUNT: int = 3

View File

@@ -3,7 +3,7 @@ from datetime import datetime, timedelta
from typing import Any, List, Optional, Sequence
import structlog
from sqlalchemy import and_, delete, distinct, func, select, tuple_, update
from sqlalchemy import and_, delete, distinct, func, pool, select, tuple_, update
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
@@ -113,6 +113,7 @@ class AgentDB:
database_string,
json_serializer=_custom_json_serializer,
connect_args=DB_CONNECT_ARGS,
poolclass=pool.NullPool if settings.DISABLE_CONNECTION_POOL else None,
)
self.Session = async_sessionmaker(bind=self.engine)