Skip to content

feat: add celery beat health check#419

Closed
saurabhhhcodes wants to merge 1 commit into
Kuldeeep18:mainfrom
saurabhhhcodes:codex/celery-beat-health-check
Closed

feat: add celery beat health check#419
saurabhhhcodes wants to merge 1 commit into
Kuldeeep18:mainfrom
saurabhhhcodes:codex/celery-beat-health-check

Conversation

@saurabhhhcodes

Copy link
Copy Markdown
Contributor

Adds a periodic Celery Beat heartbeat and a small authenticated health endpoint so the dashboard can detect when scheduled background processing stops updating.

What changed:

  • added a celery_heartbeat task that writes a timestamp into cache every minute
  • added /api/v1/health/celery-beat/ to report whether the heartbeat is fresh enough
  • configured cache backends so the heartbeat works locally and can use Redis in non-debug deployments
  • added regression tests for healthy, stale, and missing heartbeat states
  • added the campaigns migration merge file needed to keep the test database migratable on this baseline

Validation:

  • python3 -m py_compile backend/backend/settings.py backend/campaigns/tasks.py backend/campaigns/views.py backend/backend/urls.py backend/campaigns/tests.py backend/campaigns/migrations/0010_merge_0009_campaign_cached_counters_0009_campaignlead_bounce_metadata.py
  • python3 backend/manage.py test campaigns.tests.CampaignWorkflowTests.test_celery_beat_health_reports_503_until_heartbeat_updates campaigns.tests.CampaignWorkflowTests.test_celery_beat_health_reports_healthy_after_recent_heartbeat campaigns.tests.CampaignWorkflowTests.test_celery_beat_health_marks_stale_heartbeat_unhealthy -v 2
  • git diff --check

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b136faf1-59d0-457d-9ca0-ae7a4b71946e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kuldeeep18 Kuldeeep18 closed this Jun 24, 2026
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.

2 participants