Skip to content

fix for localhost redis fallback logic#394

Open
wfairclough wants to merge 1 commit intobrave:masterfrom
wfairclough:patch-1
Open

fix for localhost redis fallback logic#394
wfairclough wants to merge 1 commit intobrave:masterfrom
wfairclough:patch-1

Conversation

@wfairclough
Copy link
Copy Markdown

@wfairclough wfairclough commented Feb 14, 2026

Fix the Redis fallback logic in ‎NewRedisClient. When ‎REDIS_URL is empty, ‎strings.Split("", ",") returns ‎[]string{""} (length 1), so the old ‎len(addrs) == 0 check never triggered the localhost fallback. This moves the empty check before the split so the fallback to ‎localhost:6379 works correctly.

Also fixes a typo in Redis default port number (‎6397 -> ‎6379).

In Go `strings.Split("", ",")` returns `[]string{""}` of len == 1
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes Redis client initialization so that an unset REDIS_URL correctly falls back to a local standalone Redis instance, preventing the strings.Split("", ",") => []string{""} edge case from bypassing the fallback logic.

Changes:

  • Read REDIS_URL into a variable and check for empty before splitting, ensuring fallback is applied when unset.
  • Correct the default localhost Redis port from 6397 to 6379.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

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.

2 participants