-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: Add set_connect_options method to Pool #2088
Conversation
Please see the discussion in #1941, that's the direction we wanted to go with this. |
Thanks for the link! My understanding of the design direction from that thread (and please correct me if I'm mistaken) is to have an async-enabled @jamiebrynes7 mentioned that the
If y'all still want to go with the Provider approach, feel free to close out this PR. I can take a stab at that implementation. |
I think it would be very easy to get confused by At the same time, I'm starting to think the |
96fb4aa
to
48f69a4
Compare
48f69a4
to
ed709f7
Compare
To avoid deep-cloning the |
Since this PR wants to make breaking changes anyways, I've changed the target to the 0.7 development branch. |
8bb358e
to
5b8dfa5
Compare
@abonander - sanity checking: The |
Yeah, if you want to fix that real quick you can increase the version here to Line 151 in 1379eb6
|
This allows external updates of the ConnectionOptions used when a new connection needs to be opened for the pool. The primary use case is to support dynamically updated (read: rotated) credentials used by systems like AWS RDS.
5b8dfa5
to
d1dfcb5
Compare
Rebased on the 0.7-dev branch, copied over the sqlite fix from #2098 |
Co-authored-by: Austin Bonander <[email protected]>
* feat: Add set_connect_options method to Pool This allows external updates of the ConnectionOptions used when a new connection needs to be opened for the pool. The primary use case is to support dynamically updated (read: rotated) credentials used by systems like AWS RDS. * Use Arc wrapper for ConnectOptions to reduce lock contention * sqlite fix * Use direct assignment instead of mem::swap Co-authored-by: Austin Bonander <[email protected]> Co-authored-by: Austin Bonander <[email protected]>
* feat: Add set_connect_options method to Pool This allows external updates of the ConnectionOptions used when a new connection needs to be opened for the pool. The primary use case is to support dynamically updated (read: rotated) credentials used by systems like AWS RDS. * Use Arc wrapper for ConnectOptions to reduce lock contention * sqlite fix * Use direct assignment instead of mem::swap Co-authored-by: Austin Bonander <[email protected]> Co-authored-by: Austin Bonander <[email protected]>
* feat: Add set_connect_options method to Pool This allows external updates of the ConnectionOptions used when a new connection needs to be opened for the pool. The primary use case is to support dynamically updated (read: rotated) credentials used by systems like AWS RDS. * Use Arc wrapper for ConnectOptions to reduce lock contention * sqlite fix * Use direct assignment instead of mem::swap Co-authored-by: Austin Bonander <[email protected]> Co-authored-by: Austin Bonander <[email protected]>
* feat: Add set_connect_options method to Pool This allows external updates of the ConnectionOptions used when a new connection needs to be opened for the pool. The primary use case is to support dynamically updated (read: rotated) credentials used by systems like AWS RDS. * Use Arc wrapper for ConnectOptions to reduce lock contention * sqlite fix * Use direct assignment instead of mem::swap Co-authored-by: Austin Bonander <[email protected]> Co-authored-by: Austin Bonander <[email protected]>
This allows external updates of the
ConnectionOption
used when a new connection needs to be opened for the pool. The primary use case is to support dynamically updated (read: rotated) credentials used by systems like AWS RDS.Closes #445
Normally I shy away from using a
.expect()
invocation in code, but to my understanding the RwLock poisoning concept in the stdlib is generally regarded as a mistake.I looked at using Tokio's RwLock instead, but I didn't want to make the dynamic config update async-friendly. Doing so might encourage anyone using the dynamic config to hold the write lock while fetching the updated credentials which in turn would block any new connections from being spawned in the pool. Using a sync RwLock forces minimal holds on the lock, but Tokio's sync RwLock panics if used in an async context.
ParkingLot's RwLock does not have the poisoned concept (and therefore wouldn't require the
.expect()
) but it's not currently a dependency of the project.