Skip to content

Ref #701 -- Add support for a custom executor for synchronous checks#716

Merged
codingjoe merged 5 commits intomainfrom
issues/701/executor
Apr 15, 2026
Merged

Ref #701 -- Add support for a custom executor for synchronous checks#716
codingjoe merged 5 commits intomainfrom
issues/701/executor

Conversation

@codingjoe
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 15, 2026 15:27
@codingjoe codingjoe self-assigned this Apr 15, 2026
@codingjoe codingjoe force-pushed the issues/701/executor branch from 1ccb746 to 6dfd88b Compare April 15, 2026 15:28
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.74%. Comparing base (3decb56) to head (cee39b3).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #716   +/-   ##
=======================================
  Coverage   99.74%   99.74%           
=======================================
  Files          13       13           
  Lines         786      792    +6     
=======================================
+ Hits          784      790    +6     
  Misses          2        2           
Flag Coverage Δ
python-3.10-django-5.2 49.74% <100.00%> (+0.38%) ⬆️
python-3.10-django-5.2-celery 54.41% <100.00%> (+0.34%) ⬆️
python-3.10-django-5.2-kafka 52.65% <100.00%> (+0.36%) ⬆️
python-3.10-django-5.2-psutil 60.85% <100.00%> (+0.29%) ⬆️
python-3.10-django-5.2-rabbitmq 52.39% <100.00%> (+0.36%) ⬆️
python-3.10-django-5.2-redis 55.80% <100.00%> (+0.33%) ⬆️
python-3.10-django-5.2-rss 70.83% <100.00%> (+0.22%) ⬆️
python-3.11-django-5.2 49.74% <100.00%> (+0.38%) ⬆️
python-3.12-django-5.2 49.74% <100.00%> (+0.38%) ⬆️
python-3.12-django-6.0 49.74% <100.00%> (+0.38%) ⬆️
python-3.13-django-5.2 49.74% <100.00%> (+0.38%) ⬆️
python-3.13-django-6.0 49.74% <100.00%> (+0.38%) ⬆️
python-3.14-django-5.2 50.00% <100.00%> (+0.38%) ⬆️
python-3.14-django-5.2-celery 54.69% <100.00%> (+0.34%) ⬆️
python-3.14-django-5.2-psutil 61.16% <100.00%> (+0.29%) ⬆️
python-3.14-django-5.2-rabbitmq 52.53% <100.00%> (+0.36%) ⬆️
python-3.14-django-5.2-redis 56.09% <100.00%> (+0.33%) ⬆️
python-3.14-django-5.2-rss 71.82% <100.00%> (+0.21%) ⬆️
python-3.14-django-6.0 50.00% <100.00%> (+0.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for providing a custom executor when running synchronous health checks, enabling per-request thread pool customization and related performance/memory tuning.

Changes:

  • Plumbs an optional Executor through HealthCheck.get_result() to control run_in_executor for sync checks.
  • Wraps health check execution in HealthCheckView with a customizable get_executor() hook.
  • Updates documentation and check docstrings; adjusts MkDocs inventory configuration.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
health_check/base.py Allows passing a custom Executor into get_result() for synchronous check execution.
health_check/views.py Uses a per-request executor hook when gathering check results.
docs/usage.md Documents performance considerations and the custom-executor approach.
health_check/checks.py Docstring wording/grammar improvements.
mkdocs.yml Updates MkDocs intersphinx inventory entries.

Comment thread health_check/base.py
Comment thread mkdocs.yml Outdated
Comment thread health_check/views.py Outdated
Comment thread docs/usage.md Outdated
@codingjoe codingjoe force-pushed the issues/701/executor branch from 6dfd88b to 4176542 Compare April 15, 2026 15:32
@codingjoe codingjoe force-pushed the issues/701/executor branch from 4176542 to 3c4e201 Compare April 15, 2026 15:33
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@codingjoe
Copy link
Copy Markdown
Owner Author

@copilot address the unresolved review comments.

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

@copilot address the unresolved review comments.

Addressed all three unresolved comments in commit ddecc82:

  1. views.py: Changed get_executor to return contextlib.AbstractContextManager[Executor | None] (defaulting to contextlib.nullcontext(None)) and updated the call site to with self.get_executor() as executor:. Subclasses can now simply return a ThreadPoolExecutor (which is a valid context manager) rather than implementing a generator.

  2. docs/usage.md: Updated the wording and example to match the new contract — get_executor now returns a context manager rather than yielding.

  3. tests/test_base.py: Added test_run__sync_check_uses_custom_executor and test_run__sync_check_default_executor to verify that the executor passed to get_result() is forwarded to run_in_executor, and that the default behavior uses None.

@codingjoe
Copy link
Copy Markdown
Owner Author

pre-commit.ci run

@codingjoe codingjoe changed the title Ref #701 -- Add support for a custom executor for sychronous checks Ref #701 -- Add support for a custom executor for synchronous checks Apr 15, 2026
@codingjoe codingjoe merged commit 1f31638 into main Apr 15, 2026
30 of 31 checks passed
@codingjoe codingjoe deleted the issues/701/executor branch April 15, 2026 17:02
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.

🐛 4.x: memory and DB connection growth under frequent health checks (WSGI / Gunicorn sync workers)

3 participants