octokit/octokit.net — pull request #403 by niik (2014-02-27 22:55:20+00:00)
Title: Pipeline Http requests - for great justice

By not recreating the ```HttpClient``` for each API request we save the setup and teardown of http and ssl connections for consecutive requests at the cost of potentially keeping connections open a bit longer than necessary when consumers aren't properly disposing the client. We should be encouraging people to share the client as much as possible.

The HttpClient was [designed to be reused](http://blogs.msdn.com/b/henrikn/archive/2012/08/07/httpclient-httpclienthandler-and-httpwebrequesthandler.aspx) and it's request methods are safe to share between threads.

This is targeted against #369 as they kind of go hand in hand. The downside to all of this is that I had to make ```IHttpClient```, ```IConnection```, ```IGitHubClient``` and ```IGitHubObservableClient``` disposable.

@shiftkey Re: https://github.com/octokit/octokit.net/pull/369#issuecomment-35445166 - those results aren't matching mine when running the integration tests. 384 seconds without etags vs 317 second with (both on this branch with the shared http client though). Having looked at that run I'm not surprised we don't see greater wins though. It's basically doing every possible requests and most of them aren't cacheable (ie POSTs, PUTs) and I'm guessing at some point the cache starts clearing as well.