Skip to content

feat(redis): support configuring additional connection errors - #10158

Merged
auvipy merged 11 commits into
celery:mainfrom
abdullahmujahidali:feat/redis-additional-connection-errors-10119
Apr 4, 2026
Merged

auvipy merged 11 commits into
celery:mainfrom
abdullahmujahidali:feat/redis-additional-connection-errors-10119

Conversation

@abdullahmujahidali

Copy link
Copy Markdown
Contributor

Allow users to configure additional exception classes as connection errors for the Redis backend via result_backend_transport_options. This lets exception_safe_to_retry() recognize custom errors from Redis proxies or cloud providers. Supports both class objects and dotted import strings.

Fixes #10119

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a Redis result-backend transport option to treat user-specified exception classes as connection errors, allowing Celery’s retry/reconnect logic to recognize non-standard Redis/proxy/cloud errors.

Changes:

  • Extend RedisBackend.connection_errors with additional_connection_errors from result_backend_transport_options (supports dotted import strings and class objects).
  • Add unit tests covering configured additional connection errors and propagation into ResultConsumer.
  • Document the new additional_connection_errors option in the Redis backend guide.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
celery/backends/redis.py Reads additional_connection_errors from transport options and appends resolved symbols to connection_errors.
t/unit/backends/test_redis.py Adds tests for configuring additional connection errors (class + dotted import string) and verifying retry classification/consumer propagation.
docs/getting-started/backends-and-brokers/redis.rst Documents how to configure additional_connection_errors under result_backend_transport_options.

Comment thread celery/backends/redis.py Resolved
Comment thread t/unit/backends/test_redis.py Resolved
@codecov

codecov Bot commented Mar 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.24%. Comparing base (f9ea677) to head (e162503).
⚠️ Report is 72 commits behind head on main.

Files with missing lines Patch % Lines
celery/backends/redis.py 78.26% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10158      +/-   ##
==========================================
- Coverage   88.26%   88.24%   -0.02%     
==========================================
  Files         153      153              
  Lines       19619    19642      +23     
  Branches     2258     2264       +6     
==========================================
+ Hits        17316    17334      +18     
- Misses       2004     2007       +3     
- Partials      299      301       +2     
Flag Coverage Δ
unittests 88.22% <78.26%> (-0.02%) ⬇️

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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread celery/backends/redis.py Resolved
Comment thread celery/backends/redis.py Resolved
Comment thread celery/backends/redis.py Resolved
@abdullahmujahidali
abdullahmujahidali force-pushed the feat/redis-additional-connection-errors-10119 branch from e97187b to a890c01 Compare March 4, 2026 06:39

@auvipy auvipy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you please fix the failing tests?

@auvipy

auvipy commented Mar 30, 2026

Copy link
Copy Markdown
Member

@ChickenBenny need your recent redis experience here

@abdullahmujahidali

Copy link
Copy Markdown
Contributor Author

can you please fix the failing tests?

Auto resolved

@ChickenBenny

Copy link
Copy Markdown
Contributor

LGTM — just needs a `.. versionadded:: 5.7‵ directive in the docs (redis.rst) before merge.

@auvipy
auvipy requested a review from Copilot April 4, 2026 06:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread celery/backends/redis.py Resolved
@auvipy
auvipy merged commit 0472aac into celery:main Apr 4, 2026
352 of 354 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support configuring additional connection errors for Redis backend (e.g., ReadOnlyError)

4 participants