dawarich icon indicating copy to clipboard operation
dawarich copied to clipboard

fix: use db parameter when constructing redis client

Open diogotcorreia opened this issue 1 month ago β€’ 1 comments

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.

diogotcorreia avatar Nov 24 '25 23:11 diogotcorreia

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!
With db as 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> to unix:/// 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:// and unix:// 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_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. πŸ“ Description β€” Summarize the main change in 50–60 words, explaining what was done.
  2. πŸ““ References β€” List relevant issues, discussions, documentation, or related PRs.
  3. πŸ“¦ Dependencies & Requirements β€” Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. πŸ“Š Contributor Summary β€” Include a Markdown table showing contributions: | Contributor | Lines Added | Lines Removed | Files Changed |
  5. βœ”οΈ 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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 24 '25 23:11 coderabbitai[bot]

Should be fixed in 0.36.3

Freika avatar Dec 14 '25 21:12 Freika

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.

ThxAndBye avatar Dec 16 '25 20:12 ThxAndBye