-
Notifications
You must be signed in to change notification settings - Fork 558
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reset connections when connection-changing configuration changes
Adds a few basic features around connection and connection manager management: * `clear` on connection manager, which calls `finish` on each active connection and then disposes of it. * A centralized cross-thread tracking system for connection managers in `StripeClient` and `clear_all_connection_managers` which clears all known connection managers across all threads in a thread-safe way. The addition of these allow us to modify the implementation of some of our configuration on `Stripe` so that it can reset all currently open connections when its value changes. This fixes a currently problem with the library whereby certain configuration must be set before the first request or it remains fixed on any open connections. For example, if `Stripe.proxy` is set after a request is made from the library, it has no effect because the proxy must have been set when the connection was originally being initialized. The impetus for getting this out is that I noticed that we will need this internally in a few places when we're upgrading to stripe-ruby V5. Those spots used to be able to hack around the unavailability of this feature by just accessing the Faraday connection directly and resetting state on it, but in V5 `StripeClient#conn` is gone, and that's no longer possible.
- Loading branch information
Showing
5 changed files
with
151 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters