Skip to content

update pool-config: document all supported config keys in README, clarify inheritance and defaults usage#23

Merged
avelino merged 3 commits into
mainfrom
avelino/issue-22
Dec 13, 2025
Merged

update pool-config: document all supported config keys in README, clarify inheritance and defaults usage#23
avelino merged 3 commits into
mainfrom
avelino/issue-22

Conversation

@avelino

@avelino avelino commented Nov 2, 2025

Copy link
Copy Markdown
Member
  • Added a section in the README.md detailing all keys supported for pool configuration tuning using rq/create-client.
  • Clarifies the use of :inherit-defaults? flag to opt-out of default pooling settings.
  • Shows examples for: custom pool config, using Jedis defaults with :skip, and totally custom config without fallback defaults.
  • Rewords some sentences for clarity and documents exact parameter names for easier mapping.
  • No functional code changes; documentation only.

fixed: #22

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for Redis connection pool configuration options in the client creation process, enabling customization of pool behavior and performance tuning.
    • Enhanced client creation with flexible option map support for pool settings.
  • Documentation

    • Added comprehensive pool-configuration section to README with available options and usage examples.
  • Tests

    • Added test coverage for pool configuration resolution and client creation with configuration options.

✏️ Tip: You can customize this high-level summary in your review settings.

…rify inheritance and defaults usage

- Added a section in the README.md detailing all keys supported for pool configuration tuning using `rq/create-client`.
- Clarifies the use of `:inherit-defaults?` flag to opt-out of default pooling settings.
- Shows examples for: custom pool config, using Jedis defaults with `:skip`, and totally custom config without fallback defaults.
- Rewords some sentences for clarity and documents exact parameter names for easier mapping.
- No functional code changes; documentation only.

fixed: #22

Signed-off-by: Avelino <31996+avelino@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Nov 2, 2025

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR introduces configurable Redis connection pool settings. Users can now customize GenericObjectPoolConfig before client creation via the expanded create-client function, supporting multiple arities with optional pool configuration parameters and flexible reference handling.

Changes

Cohort / File(s) Change Summary
Documentation
README.md
Added pool-configuration section documenting rq/create-client pool-config options and usage examples
Pool Configuration Implementation
src/com/moclojer/rq.clj
Added Java interop imports (URI, URISyntaxException, GenericObjectPoolConfig); introduced default-pool-settings map and pool-config-setters mapping; added build-pool-config, resolve-pool-config, and create-pool private helpers; expanded create-client to three arities supporting optional pool configuration with validation and flexible reference handling
Tests & Fixes
test/com/moclojer/rq_test.clj
Added pool-config-resolution-test and create-client-with-options-test; fixed typo in comment ("runing" → "running")

Sequence Diagram

sequenceDiagram
    participant User as User Code
    participant API as create-client
    participant Resolve as resolve-pool-config
    participant Build as build-pool-config
    participant Pool as create-pool
    participant Jedis as JedisPooled
    participant Ref as *redis-pool*

    User->>API: (url, opts-map)
    API->>API: Validate opts keys
    API->>Resolve: pool-config from opts
    alt pool-config is nil
        Resolve->>Build: merge defaults
        Build->>Resolve: GenericObjectPoolConfig
    else pool-config is :skip
        Resolve->>Resolve: Return :skip
    else existing GenericObjectPoolConfig
        Resolve->>Resolve: Return as-is
    end
    API->>Pool: url + resolved config
    Pool->>Jedis: new JedisPooled(uri, config)
    alt ref? = true
        API->>Ref: Store pool
        API->>User: Return stored pool
    else ref? = false
        API->>User: Return atom-wrapped pool
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • build-pool-config & resolve-pool-config: Validation logic and configuration resolution with multiple code paths require careful review
  • create-client arities: Three different function signatures with distinct behaviors (ref? handling, pool config application) need cross-validation
  • URI parsing and error handling: Java interop with URISyntaxException requires verification of exception propagation

Possibly related PRs

  • API improvement refactor #5: Modifies the same core create-client API in src/com/moclojer/rq.clj with changes to client creation behavior and management.

Suggested reviewers

  • J0sueTM
  • Felipe-gsilva

Poem

🐰 A rabbit configures pools with care,
Building configs here and there,
No magic defaults block the way,
Each setting tuned, each pool at play! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "update pool-config: document all supported config keys in README, clarify inheritance and defaults usage" directly aligns with the primary changes in the changeset. The code modifications introduce pool configuration functionality (default-pool-settings, build-pool-config, resolve-pool-config, and expanded create-client with three arities), while the README updates document the new pool configuration feature with inheritance and defaults behavior. The title accurately captures both the implementation and documentation aspects of this change, making it clear and specific for a developer scanning history.
Linked Issues Check ✅ Passed The pull request successfully addresses all coding requirements from issue #22. The implementation introduces pool configuration adjustability at client creation time through the expanded create-client function with pool-config parameter support, enabling tuning of JedisPool parameters via default-pool-settings, build-pool-config, and resolve-pool-config functions. The README documentation section provides examples and explains the configuration options, inheritance behavior, and the :skip mechanism. The test file validates pool configuration resolution and client creation with options, confirming that the feature works as intended and meets the stated objectives.
Out of Scope Changes Check ✅ Passed All changes in this pull request are directly related to the pool configuration feature scope defined in issue #22. The README updates document the new configuration capability; the rq.clj modifications implement the core pool configuration functions and expand create-client to support configurable pools; and the test file validates the new functionality. The minor typo fix in a test comment ("runing" to "running") is incidental to the feature work and does not represent a meaningful out-of-scope change. No unrelated features, refactoring, or maintenance tasks are present in this changeset.

📜 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 ea2f497 and 4facac2.

📒 Files selected for processing (1)
  • README.md (2 hunks)

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

@avelino avelino requested a review from Copilot November 2, 2025 03:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds configurable connection pool settings to the Redis client, allowing users to customize GenericObjectPoolConfig parameters when creating a client. Previously, the library relied on Jedis' default pool configuration without any customization options.

  • Added pool configuration support with sensible defaults (max-total: 128, min-idle: 16, health checks enabled)
  • Implemented flexible configuration resolution supporting maps, instances, or :skip keyword
  • Updated create-client to accept an options map as the second parameter (backward compatible)

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/com/moclojer/rq.clj Core implementation: added pool configuration data structures, resolution logic, and updated create-client to support options map
test/com/moclojer/rq_test.clj Comprehensive tests for pool configuration resolution and options map usage
README.md Documentation for pool configuration feature with usage examples and supported keys

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

Comment thread test/com/moclojer/rq_test.clj Outdated
Comment thread README.md
@@ -166,7 +165,35 @@ The `clj-rq` library provides a set of pub/sub functions that facilitate message
```clojure
(rq-pubsub/unarquive-channel! client "my-channel")

Copilot AI Nov 2, 2025

Copy link

Choose a reason for hiding this comment

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

Corrected spelling of 'unarquive' to 'unarchive'.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/com/moclojer/rq.clj (1)

138-144: Restore global pool reuse when ref? is true.

When ref? is true and *redis-pool* already holds a pool, we should hand that ref back without creating (and leaking) another JedisPooled. The current logic always builds a new pool and wraps it in a fresh atom, so callers lose the shared ref and we allocate an unused connection.

   ([url ref? pool-config]
-   (let [pool (create-pool url pool-config)
-         store? (boolean ref?)]
-     (if (and store? (not @*redis-pool*))
-       (dosync
-        (ref-set *redis-pool* pool)
-        *redis-pool*)
-       (atom pool))))
+   (let [store? (boolean ref?)]
+     (if (and store? @*redis-pool*)
+       *redis-pool*
+       (let [pool (create-pool url pool-config)]
+         (if store?
+           (dosync
+            (ref-set *redis-pool* pool)
+            *redis-pool*)
+           (atom pool))))))
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0dea5a and f97759b.

📒 Files selected for processing (3)
  • README.md (2 hunks)
  • src/com/moclojer/rq.clj (2 hunks)
  • test/com/moclojer/rq_test.clj (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2024-09-05T10:25:29.194Z
Learnt from: J0sueTM
Repo: moclojer/clj-rq PR: 0
File: :0-0
Timestamp: 2024-09-05T10:25:29.194Z
Learning: The `src/com/moclojer/rq/pubsub.clj` file contains the following functions: `publish!`, `group-handlers-by-channel`, `create-listener`, `unarquive-channel!`, `pack-workers-channels`, and `subscribe!`.

Applied to files:

  • README.md
📚 Learning: 2024-07-03T18:17:54.022Z
Learnt from: J0sueTM
Repo: moclojer/clj-rq PR: 5
File: test/com/moclojer/rq/pubsub_test.clj:8-27
Timestamp: 2024-07-03T18:17:54.022Z
Learning: In the `pubsub-test` function, the user prefers not to include `close-client` in the `finally` block, arguing that the client will be down automatically if there's a problem.

Applied to files:

  • README.md
📚 Learning: 2024-10-08T19:16:22.185Z
Learnt from: J0sueTM
Repo: moclojer/clj-rq PR: 6
File: src/com/moclojer/rq/queue.clj:10-13
Timestamp: 2024-10-08T19:16:22.185Z
Learning: In the `push!` function of `src/com/moclojer/rq/queue.clj`, options are passed directly as keyword arguments, not within a map.

Applied to files:

  • src/com/moclojer/rq.clj

Comment thread README.md
@avelino

avelino commented Nov 2, 2025

Copy link
Copy Markdown
Member Author

@coderabbitai generate docstrings

@coderabbitai

coderabbitai Bot commented Nov 2, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Initiated docstring generation; will generate only if new commits exist.

@coderabbitai

coderabbitai Bot commented Nov 2, 2025

Copy link
Copy Markdown
Contributor

Caution

Docstrings generation - FAILED

No docstrings were generated.

@avelino avelino merged commit 69ac2b8 into main Dec 13, 2025
2 of 3 checks passed
@avelino avelino deleted the avelino/issue-22 branch December 13, 2025 11:37
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.

configure pool before creation

2 participants