fix: parse DB number from redis-sentinel URI path#1100
Open
ljluestc wants to merge 1 commit intohibiken:masterfrom
Open
fix: parse DB number from redis-sentinel URI path#1100ljluestc wants to merge 1 commit intohibiken:masterfrom
ljluestc wants to merge 1 commit intohibiken:masterfrom
Conversation
Previously, parseRedisSentinelURI ignored the /dbnumber path segment, making it impossible to connect to any DB other than 0 via sentinel URIs. This adds DB extraction from the URI path, consistent with how parseRedisURI already handles it for redis:// and rediss:// schemes. Closes hibiken#669
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1100 +/- ##
==========================================
- Coverage 67.13% 63.39% -3.75%
==========================================
Files 29 29
Lines 4300 4991 +691
==========================================
+ Hits 2887 3164 +277
- Misses 1135 1549 +414
Partials 278 278 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kamikazechaser
approved these changes
Apr 9, 2026
Collaborator
|
@ljluestc Let me know if you want to add something else to it cause it was marked as draft. |
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.
fix: parse DB number from redis-sentinel URI path (#669)
Problem
parseRedisSentinelURI ignored the /dbnumber path segment, making it impossible to connect to any DB other than 0 via sentinel URIs. For example:
text
would silently drop the /3 and always use DB 0.
The redis:// and rediss:// schemes already supported this via parseRedisURI.
Changes
• asynq.go: Extract the DB number from the URI path in parseRedisSentinelURI, using the same strconv.Atoi(xs[0]) pattern as parseRedisURI. Pass the parsed DB into RedisFailoverClientOpt. Return a descriptive error if the path segment is not a valid integer.
• asynq.go doc comment: Updated the ParseRedisURI godoc to show /dbnumber in the sentinel URI format:
text
• asynq_test.go: Added test cases:
◦ redis-sentinel://...5002/3?master=mymaster → DB 3
◦ redis-sentinel://:mypassword@...5002/7?master=mymaster → DB 7 with password
◦ redis-sentinel://localhost:5000/abc?master=mymaster → error (non-integer)