Skip to content

feature: accept sentinel:// and redis+sentinel:// as scheme aliases - #333

Draft
sibson wants to merge 2 commits into
mainfrom
fix/issue-199
Draft

sibson wants to merge 2 commits into
mainfrom
fix/issue-199

Conversation

@sibson

@sibson sibson commented Aug 14, 2026

Copy link
Copy Markdown
Owner

What & why

get_redis() only routed to the Sentinel branch when redbeat_redis_url
started with redis-sentinel. Celery's own native sentinel scheme is
sentinel:// and kombu's is redis+sentinel://, so a user who reuses their
broker DSN for redbeat_redis_url falls through to Redis.from_url and gets an
unhelpful failure.

Fix

Match all three scheme spellings:

elif (
    conf.redis_url.startswith(('redis-sentinel', 'sentinel://', 'redis+sentinel://'))
    and 'sentinels' in redis_options
):

Scope — please read

This is deliberately only a scheme match, not full celery-native sentinel
support. The and 'sentinels' in redis_options condition is unchanged, so this
helps only if redbeat_redis_options (or broker_transport_options) already
supplies an explicit sentinels list. A purely celery-native config —
master_name in broker_transport_options with hosts derived from a
;-joined sentinel:// URL — still falls through and still raises.

The CHANGES.txt entry and the new docs/config.rst paragraph both say so
explicitly, so nobody reads this as more than it is. If you'd rather this go
the whole way and derive sentinels/master_name from the URL, that's a
larger change and worth its own issue.

Test plan

  • Added regression coverage in tests/test_scheduler.py for both new aliases.
  • make test passes (91 tests).

Closes #199


Generated by Claude Code

claude added 2 commits August 14, 2026 05:02
…ixes #199

Celery's native broker URL format uses sentinel:// and kombu uses
redis+sentinel:// for Redis Sentinel, while RedBeat only recognized its own
redis-sentinel:// scheme in the sentinel branch of get_redis(). Accepting
these as aliases lets the same DSN be reused for both broker_url and
redbeat_redis_url, removing the need to rewrite the scheme by hand.
…m, document scheme aliases, add regression test

- redbeat/schedulers.py: reformat the sentinel branch condition to match
  black's output (flake8-black failed CI as committed).
- CHANGES.txt: change the entry to bugfix, and qualify what the scheme
  aliases actually deliver -- they only help once redbeat_redis_options
  (or broker_transport_options) already sets a redbeat-shaped `sentinels`
  list. A purely celery-native sentinel config (broker_transport_options
  with just master_name, hosts from a `;`-joined sentinel:// URL) still
  falls through to Redis.from_url and still raises.
- docs/config.rst: document that sentinel:// and redis+sentinel:// are
  now accepted as scheme aliases, and spell out that the sentinels
  option is still required with them.
- tests/test_scheduler.py: add a regression test pinning the remaining
  limitation -- a purely celery-native sentinel broker config without an
  explicit sentinels option still raises ValueError.
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.

Support for Celery 4+ sentinel:// urls

2 participants