Skip to content

Refactor DbContextManager to correctly handle async sessions and increase pool size#230

Merged
edulauer merged 2 commits intomainfrom
issue-229
Oct 10, 2025
Merged

Refactor DbContextManager to correctly handle async sessions and increase pool size#230
edulauer merged 2 commits intomainfrom
issue-229

Conversation

@edulauer
Copy link
Member

Fix #229
This PR refactors the DbContextManager to follow async SQLAlchemy best practices and to avoid QueuePool limit error by:

  • Storing the async_sessionmaker factory instead of creating a session in init.
  • Moving session creation to aenter so each context gets a fresh AsyncSession.
  • Ensuring proper commit/rollback handling in aexit.
  • Increase pool_size and max_overflow limit (from 5 to 15)

@edulauer edulauer requested a review from fgomesbarros October 10, 2025 17:56
@edulauer edulauer merged commit b1568f0 into main Oct 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PARTICIPANTE] Indisponibilidade do endpoint que atualiza informações do participante

2 participants