fix(api): omit Redis auth segment when password is not configured - #1266
Merged
Merged
Conversation
When redis_password is None (the default), the previous f-string produced "redis://:None@host:port/db" — the Python None got stringified, so redis-py sent AUTH None to Redis and failed on any password-less server. Extract _build_redis_url() to conditionally include the ':password@' auth segment only when a password is actually set. Tests cover None, empty-string (both map to no auth) and a real password value.
Owner
|
Thank you for the fix. I verified it with a real passwordless Redis container, including connection, read/write, and task queue round-trip tests. Everything worked as expected, and the PR has been merged. Appreciate your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
redis_passwordis unset (the defaultNone), the previous f-stringproduced
redis://:None@host:port/db— Python'sNonegot stringified verbatim,so redis-py sent
AUTH Noneto Redis and failed on every password-less server._build_redis_url()helper that only includes the:password@auth segment when a password is actually provided.
None, empty string (both produce a no-auth URL), and a real passwordvalue with unit tests.
Test plan
TestBuildRedisUrl.test_no_password_omits_auth_segment—Noneand""both produceredis://localhost:6379/0TestBuildRedisUrl.test_password_is_included_in_url— real password produces correct URLTestVideoControllerTasksandTestRedisTaskManagersuites still pass