Skip to content

Commit

Permalink
increase db pool size
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaskoepf committed Feb 4, 2023
1 parent b724b37 commit effbde4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions backend/oasst_backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ class Settings(BaseSettings):
DATABASE_URI: Optional[PostgresDsn] = None
DATABASE_MAX_TX_RETRY_COUNT: int = 3

DATABASE_POOL_SIZE = 128
DATABASE_MAX_OVERFLOW = 128

RATE_LIMIT: bool = True
MESSAGE_SIZE_LIMIT: int = 2000
REDIS_HOST: str = "localhost"
Expand Down
8 changes: 7 additions & 1 deletion backend/oasst_backend/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@
if settings.DATABASE_URI is None:
raise OasstError("DATABASE_URI is not set", error_code=OasstErrorCode.DATABASE_URI_NOT_SET)

engine = create_engine(settings.DATABASE_URI, echo=settings.DEBUG_DATABASE_ECHO, isolation_level="REPEATABLE READ")
engine = create_engine(
settings.DATABASE_URI,
echo=settings.DEBUG_DATABASE_ECHO,
isolation_level="REPEATABLE READ",
pool_size=settings.DATABASE_POOL_SIZE,
max_overflow=settings.DATABASE_MAX_OVERFLOW,
)

0 comments on commit effbde4

Please sign in to comment.