Disable connection pooler if env specifies it (#2222)
This commit is contained in:
@@ -32,6 +32,7 @@ class Settings(BaseSettings):
|
|||||||
DEBUG_MODE: bool = False
|
DEBUG_MODE: bool = False
|
||||||
DATABASE_STRING: str = "postgresql+psycopg://skyvern@localhost/skyvern"
|
DATABASE_STRING: str = "postgresql+psycopg://skyvern@localhost/skyvern"
|
||||||
DATABASE_STATEMENT_TIMEOUT_MS: int = 60000
|
DATABASE_STATEMENT_TIMEOUT_MS: int = 60000
|
||||||
|
DISABLE_CONNECTION_POOL: bool = False
|
||||||
PROMPT_ACTION_HISTORY_WINDOW: int = 1
|
PROMPT_ACTION_HISTORY_WINDOW: int = 1
|
||||||
TASK_RESPONSE_ACTION_SCREENSHOT_COUNT: int = 3
|
TASK_RESPONSE_ACTION_SCREENSHOT_COUNT: int = 3
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from datetime import datetime, timedelta
|
|||||||
from typing import Any, List, Optional, Sequence
|
from typing import Any, List, Optional, Sequence
|
||||||
|
|
||||||
import structlog
|
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.exc import SQLAlchemyError
|
||||||
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
||||||
|
|
||||||
@@ -113,6 +113,7 @@ class AgentDB:
|
|||||||
database_string,
|
database_string,
|
||||||
json_serializer=_custom_json_serializer,
|
json_serializer=_custom_json_serializer,
|
||||||
connect_args=DB_CONNECT_ARGS,
|
connect_args=DB_CONNECT_ARGS,
|
||||||
|
poolclass=pool.NullPool if settings.DISABLE_CONNECTION_POOL else None,
|
||||||
)
|
)
|
||||||
self.Session = async_sessionmaker(bind=self.engine)
|
self.Session = async_sessionmaker(bind=self.engine)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user