fix: use db parameter when constructing redis client
Fixes #1507 (#1706)
Continuation of #1508
Summary by CodeRabbit
- Chores
- Updated internal background job queue configuration to use separated Redis connection parameters.
βοΈ Tip: You can customize this high-level summary in your review settings.
Walkthrough
This change refactors Sidekiq's Redis client configuration by separating the database index specification from the connection URL. Rather than appending the database number to the URL string, the configuration now uses a distinct db parameter sourced from environment variables, enabling support for both standard Redis and Unix socket URIs.
Changes
| Cohort / File(s) | Summary |
|---|---|
Redis Client Configuration Split config/initializers/sidekiq.rb |
Separated Redis database index from URL string: changed from embedded path (e.g., redis://host:6379/1) to split configuration using url: ENV['REDIS_URL'] and db: ENV.fetch('RAILS_JOB_QUEUE_DB', 1) for Sidekiq client setup. |
Estimated code review effort
π― 2 (Simple) | β±οΈ ~8 minutes
- Single file modification with straightforward configuration refactoring
- Consistent parameter extraction pattern with appropriate fallback
- Fix addresses Unix socket URI compatibility without altering core logic
Poem
π° A socket's lament turned jubilant song,
No more paths twisted wrong!
Withdbas a friend, both unix and redis play,
Configuration harmony saves the day! π
Pre-merge checks and finishing touches
β Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The PR title 'fix: use db parameter when constructing redis client' accurately describes the main changeβreplacing embedded database index in URL with the db parameter. |
| Linked Issues check | β Passed | The code change directly addresses issue #1507 by using the db parameter instead of appending to REDIS_URL, enabling support for both unix:// and redis:// URIs. |
| Out of Scope Changes check | β Passed | All changes are directly scoped to fixing Redis client configuration; only sidekiq.rb was modified with no extraneous alterations. |
| Docstring Coverage | β Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
β¨ Finishing touches
- [ ] π Generate docstrings
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
π Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π₯ Commits
Reviewing files that changed from the base of the PR and between 52eb80503d2717e8bc203d440b48d0965e92ebe7 and d4e3ce76a1379ed6da7a4a66cd7a71b2ebd4395d.
π Files selected for processing (1)
config/initializers/sidekiq.rb(1 hunks)
π§° Additional context used
π§ Learnings (1)
π Learning: 2025-09-29T21:15:25.496Z
Learnt from: CR
Repo: Freika/dawarich PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-29T21:15:25.496Z
Learning: Applies to app/jobs/**/*.rb : Implement long-running or asynchronous work as Sidekiq background jobs
Applied to files:
config/initializers/sidekiq.rb
𧬠Code graph analysis (1)
config/initializers/sidekiq.rb (1)
config/application.rb (1)
config(12-41)
π Additional comments (1)
config/initializers/sidekiq.rb (1)
27-27: Excellent fix for Unix socket support - verified.The configuration change correctly separates the database index from the connection URL, which prevents the Unix socket URI path corruption that occurred when appending
/<number>tounix:///URIs. Sidekiq's config.redis accepts a Hash and forwards options to the underlying Redis client, which supports both url and separate db parameters.This approach works for both
redis://andunix://URI schemes and is now consistent with the server configuration pattern on line 4.
[!TIP]
π Customizable high-level summaries are now available in beta!
You can now customize how CodeRabbit generates the high-level summary in your pull requests β including its content, structure, tone, and formatting.
- Provide your own instructions using the
high_level_summary_instructionssetting.- Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
- Use
high_level_summary_in_walkthroughto move the summary from the description to the walkthrough section.Example instruction:
"Divide the high-level summary into five sections:
- π Description β Summarize the main change in 50β60 words, explaining what was done.
- π References β List relevant issues, discussions, documentation, or related PRs.
- π¦ Dependencies & Requirements β Mention any new/updated dependencies, environment variable changes, or configuration updates.
- π Contributor Summary β Include a Markdown table showing contributions:
| Contributor | Lines Added | Lines Removed | Files Changed |- βοΈ Additional Notes β Add any extra reviewer context. Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Should be fixed in 0.36.3
Dawarich 0.36.3 started just fine with valkey and the database connected via a UNIX socket Thanks to everyone involved in getting this working.