Skip to content

Conversation

@nathanfranklin
Copy link
Collaborator

@nathanfranklin nathanfranklin commented Oct 21, 2025

Overview:

This PR works on changes for our db connections as no connections available error on prod is occuring.

  • Add app name to db connection for monitoring/debugging
  • Create one shared engine/pool for all Celery tasks via get_celery_engine()
  • Fix database session leak issue in WebSocket use of auth handlers (added context manager to close sessions)
  • Add shorter WebSocket timeout for local dev so restart occurs during change Note: hot restart might just be workign as we no longer have a stale in transaction connection

Background info

  • max_connections = 200 on database (see here)
  • Note to monitor connection are in confluence here
  • Follow on work is noted WG-598)

Related Jira tickets:

Testing Steps:

  1. Deploying to staging to test and monitor

@nathanfranklin nathanfranklin changed the title Hotfix/improve db connections task/WG-594 improve db connections Oct 29, 2025
WebSocket connections stay open longer which was causing DB sessions
in auth handlers to leak. (HTTP requests were fine because the
autocommit approach was cleaning things up correctly). Now, added a
context manager to explicitly commit and close DB sessions. Some is
overkill as the autocommit for HTTP requests is fine but adding the
context manager anyway just to be consistent and in case they're
ever used in WebSocket routes.
@nathanfranklin nathanfranklin merged commit a81c072 into main Oct 31, 2025
3 checks passed
@nathanfranklin nathanfranklin deleted the hotfix/improve-db-connections branch October 31, 2025 16:57
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.

3 participants