Skip to content

Fix #699 -- Gracefully handle None value from active_queues in Celery#700

Merged
codingjoe merged 3 commits intocodingjoe:mainfrom
saschabuehrle:fix/issue-699-celery-active-queues-none
Apr 9, 2026
Merged

Fix #699 -- Gracefully handle None value from active_queues in Celery#700
codingjoe merged 3 commits intocodingjoe:mainfrom
saschabuehrle:fix/issue-699-celery-active-queues-none

Conversation

@saschabuehrle
Copy link
Copy Markdown
Contributor

Fixes #699

inspect(...).active_queues() can return None when the broker is restarting. This makes check_active_queues() handle a missing inspect payload as an empty queue mapping, so it reports unavailable queues instead of crashing with AttributeError.

Added a regression test for the None return path.

Greetings, saschabuehrle

Copy link
Copy Markdown
Owner

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

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

Hi @saschabuehrle,

Thanks for reaching out and providing a patch.
I think this can either be solved with a tiny or {} change, or you catch the attribute error. Both work for me.

Extra kudos for the test!

Cheers!
Joe

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #700      +/-   ##
==========================================
- Coverage   99.74%   99.74%   -0.01%     
==========================================
  Files          13       13              
  Lines         787      786       -1     
==========================================
- Hits          785      784       -1     
  Misses          2        2              
Flag Coverage Δ
python-3.10-django-5.2 49.36% <ø> (-0.07%) ⬇️
python-3.10-django-5.2-celery 54.07% <ø> (-0.06%) ⬇️
python-3.10-django-5.2-kafka 52.29% <ø> (-0.07%) ⬇️
python-3.10-django-5.2-psutil 60.55% <ø> (-0.06%) ⬇️
python-3.10-django-5.2-rabbitmq 52.03% <ø> (-0.07%) ⬇️
python-3.10-django-5.2-redis 55.47% <ø> (-0.06%) ⬇️
python-3.10-django-5.2-rss 70.61% <ø> (-0.04%) ⬇️
python-3.11-django-5.2 49.36% <ø> (-0.07%) ⬇️
python-3.12-django-5.2 49.36% <ø> (-0.07%) ⬇️
python-3.12-django-6.0 49.36% <ø> (-0.07%) ⬇️
python-3.13-django-5.2 49.36% <ø> (-0.07%) ⬇️
python-3.13-django-6.0 49.36% <ø> (-0.07%) ⬇️
python-3.14-django-5.2 49.61% <ø> (-0.07%) ⬇️
python-3.14-django-5.2-celery 54.34% <ø> (-0.06%) ⬇️
python-3.14-django-5.2-psutil 60.86% <ø> (-0.05%) ⬇️
python-3.14-django-5.2-rabbitmq 52.17% <ø> (-0.07%) ⬇️
python-3.14-django-5.2-redis 55.75% <ø> (-0.06%) ⬇️
python-3.14-django-5.2-rss 71.61% <ø> (-0.04%) ⬇️
python-3.14-django-6.0 49.61% <ø> (-0.07%) ⬇️

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
Owner

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

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

I took the liberty to amend a commit.

@codingjoe codingjoe changed the title fix: handle none active_queues in celery health check Fix #699 -- Gracefully handle None value from active_queues in Celery Apr 9, 2026
@codingjoe codingjoe merged commit 3decb56 into codingjoe:main Apr 9, 2026
27 of 28 checks passed
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.

🐛 Celery ping check crashes when broker restarts

2 participants