fix: rebuild connection cache on timeout #2382
Merged
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.
What this PR does / why we need it:
When creating the http client we cache the client against the host without any expiration
In this scenario the node when rebooted was still picking the client from cache for any further request
The cached client had resolved the IP that was assigned to the node prior to reboot hence restarting resolved the issue
A fix for this would be to add a custom round tripper in the transport layer which can invalidate the cache and build a new http client in case of a timeout, this way the it will attempt to resolve the new IP for that host
Which issue(s) this PR fixes (optional)
PWX-35254
Testing Notes
restart one of the storage node and assign it a new IP address without changing the hostname
it will defer the cached client and should build a new client that resolves the correct IP address