Rework HTTP::Client
logic
#5235
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on #5081
I'm making this pull request target a branch that has the same commit history as #5081 to make it easier to review
This PR replaces the current force resolve implementation which patches stdlib to one that is based around a custom IO.
In addition to accommodate the lack of the automatic reconnect feature the connection pool now uses
DB::Pool#retry
DB::Pool#retry
allows us to cycle until we find a client that that still has an open connection, or to create a new one if necessary. The poisoned clients are then removed once identified by#retry
's internal logicThe fact that clients with closed connections will now be slowly removed also means that Invidious will no longer use the same pattern of companion connections within the pool. The closed connections will cause new connections that will each select a random companion to connect to
Closes #5230
Closes #4662