Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration of r2d2 connection pool #149

Closed
goyal-anshul opened this issue Aug 12, 2024 · 2 comments
Closed

Allow configuration of r2d2 connection pool #149

goyal-anshul opened this issue Aug 12, 2024 · 2 comments

Comments

@goyal-anshul
Copy link
Contributor

goyal-anshul commented Aug 12, 2024

We came across a scenario in our app where we needed to build r2d2::Pool with custom configuration settings, specifically setting min_idle and idle_timeout. Currently we are using memcache::Client::with_pool_size and there seem to be no way to configure settings for r2d2::Pool.

We found memcache::Client::with_pool where we can pass custom connection manager pool but it does not take an array so I can only pass a single pool for a single memcache node.

It would be nice to either allow passing configuration for r2d2 via with_pool_size function or add a new function that will take a vector of connection manager pool as shown below:

pub fn with_pools(pools: Vec<Pool<ConnectionManager>>) -> Result<Self, MemcacheError> {
        Ok(Client {
            connections: pools,
            hash_function: default_hash_function,
        })
    }

To workaround this limitation, we have patched the crate in our repo and applying some configuration to r2d2 in with_pool_size function. It would be great if this is available in the crate itself.

@goyal-anshul goyal-anshul changed the title Allow configuration of r2d2 configuration pool Allow configuration of r2d2 connection pool Aug 13, 2024
@aisk
Copy link
Owner

aisk commented Oct 5, 2024

Hi @goyal-anshul Thank you for reporting this! I added your with_pools implementation in #150.

@aisk
Copy link
Owner

aisk commented Oct 7, 2024

Shipped in v0.18.0.

@aisk aisk closed this as completed Oct 7, 2024
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

No branches or pull requests

2 participants