Skip to content

Ensure MCP db connections are cleaned up - #319

Merged
alexbainter merged 1 commit into
mainfrom
alex-302-async-db-connection-cleanup
Aug 10, 2026
Merged

Ensure MCP db connections are cleaned up#319
alexbainter merged 1 commit into
mainfrom
alex-302-async-db-connection-cleanup

Conversation

@alexbainter

@alexbainter alexbainter commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Closes #302.

Adds a new decorator sync_to_async_with_db_cleanup which wraps sync_to_async but also ensures Django database connections are cleaned up after use. Django normally does this for us, but because we're doing MCP operations outside of Django and in a worker, we need to clean these connections up ourselves.

@alexbainter
alexbainter merged commit 323e14e into main Aug 10, 2026
11 checks passed
@alexbainter
alexbainter deleted the alex-302-async-db-connection-cleanup branch August 10, 2026 17:24
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.

Close stale database connections used by the MCP server

2 participants