Skip to content

Conversation

gmarz
Copy link
Contributor

@gmarz gmarz commented Nov 14, 2014

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.

gmarz and others added 24 commits November 6, 2014 22:32
…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
@gmarz gmarz changed the title Refactor/transport stream handling Refactor transport layer and connection pool 401 handling Nov 14, 2014
@gmarz gmarz mentioned this pull request Nov 14, 2014
@gmarz gmarz added the WIP label Nov 14, 2014
@gmarz gmarz added the v1.3.0 label Nov 17, 2014
gmarz added a commit that referenced this pull request Nov 19, 2014
…-handling

Refactor transport layer and connection pool 401 handling
@gmarz gmarz merged commit b778158 into develop Nov 19, 2014
@gmarz gmarz added New Feature and removed WIP labels Nov 19, 2014
@gmarz gmarz deleted the refactor/transport-stream-handling branch November 19, 2014 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants