Q42/Q42.HueApi — pull request #32 by tg2k (2014-10-24 23:04:29+00:00)
Title: Reuse HttpClient instances. As mentioned in http://blogs.msdn.com/b/henr...

...ikn/archive/2012/02/11/httpclient-is-here.aspx and http://stackoverflow.com/questions/15705092/do-httpclient-and-httpclienthandler-have-to-be-disposed , HttpClient is meant to be a long-lived instance. When it is created new for each request, if lots of requests are occurring, then a lot of AggregateExceptions containing HttpRequestExceptions or SocketExceptions occur (often one every few minutes). With long-lived instances, errors are much rarer (often once per hour or less). Note that I first tried disposing the HttpClient instances promptly (hoping that prompt cleanup would avoid any underlying resource saturation issues), but this did not improve stability.