-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactor transport layer and connection pool 401 handling #1060
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
Merged
Conversation
This file contains hidden or 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
…zed ping requests
…t by throwing a PingUnauthorizedException
…d async, introduced synchrounous code path memory tests
…handling Conflicts: src/Elasticsearch.Net/Connection/Transport.cs
Also making sure the same default is used across all ping calls. Closes #1058
Closed
MaxRetryException should only be thrown when the client is setup to retry.
gmarz
added a commit
that referenced
this pull request
Nov 19, 2014
…-handling Refactor transport layer and connection pool 401 handling
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR does not change anything on the outside API merely improves several aspects of our internal request handling:
Memory handling unit tests
We've added unit tests for the stream handling of all codepaths to ensure that response streams are closed and depending on the code path only read once, or if an intermediary memory stream is created to ensure that one is disposed as well. The latter is needed e.g when you want to expose the raw result on your response object.
We didn't uncover any mishaps (whoohoo) but these tests gave us the confidence to refactor other parts of our transport layer. Other aspects (responses, exceptions, errors, failover, loadbalancing) were already heavily unit tested.
Refactor transport.cs
Still a work in progress but this PR moves the request handling out of the god like Transport class into their own RequestHandler and RequestHandlerAsync classes. This improves legibility and frees transport to having one sole job and that is to coordinate requests with connectionpools.
401 handling
We've improved the way we handle 401 (Unauthorized) responses so that they do not failover and fail as fast as possible e.g a ping/sniff/call returning a 401 on a node should fail right then and there.