Skip to content

Close old database connections around task execution - #43

Merged
codingjoe merged 3 commits into
mainfrom
fix-load-django
Sep 2, 2026
Merged

Close old database connections around task execution#43
codingjoe merged 3 commits into
mainfrom
fix-load-django

Conversation

@codingjoe

@codingjoe codingjoe commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Long-running worker processes otherwise hold on to database connections for the life of the process, so stale or broken connections get reused across tasks. This gives tasks the same connection lifecycle Django gives request handlers: connections are dropped via close_old_connections() when a task starts and when it finishes, honoring CONN_MAX_AGE.

codingjoe and others added 3 commits August 10, 2026 18:25
Register a receiver for the task_started and task_finished signals that
calls close_old_connections(), so worker processes reuse database
connections the same way request handlers do, honoring CONN_MAX_AGE.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@codingjoe
codingjoe merged commit 851e69d into main Sep 2, 2026
4 checks passed
@codingjoe
codingjoe deleted the fix-load-django branch September 2, 2026 19:16
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.

1 participant