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

Is it possible to create a new connection pool if the servers are offline #34

Closed
bbigras opened this issue Mar 19, 2017 · 3 comments
Closed

Comments

@bbigras
Copy link

bbigras commented Mar 19, 2017

My application create a pool at startup to connect to one API and right now this API is down so my application can't start. I don't really need the API to be up when I start my application, only when I get a request for it.

Is there a way to do that?

@sfackler
Copy link
Owner

Yep, just set initialization_fail_fast to false.

@bbigras
Copy link
Author

bbigras commented Mar 20, 2017

initialization_fail_fast(false) works and if I use min_idle(Some(0)) my application will only try to connect if needed. Nice.

If r2d2 is not able to connect, pool.get() will return an error but will still try to connect. It seems to ignore the min_idle set to 0. Is it normal behavior?

@sfackler
Copy link
Owner

I'm not sure it's explicitly intentional, more that it falls out from the implementation and generally feels like a reasonable thing to do - if you're trying to get a connection now, you'll probably be trying to get a connection again in the future.

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