improve httpclient resource disposal

This commit is contained in:
Luke Pulverenti
2017-10-20 12:16:56 -04:00
parent 86226ff97c
commit 060215143f
36 changed files with 664 additions and 601 deletions

View File

@@ -88,15 +88,18 @@ namespace Emby.Server.Implementations.News
BufferContent = false
};
using (var stream = await _httpClient.Get(requestOptions).ConfigureAwait(false))
using (var response = await _httpClient.SendAsync(requestOptions, "GET").ConfigureAwait(false))
{
using (var reader = XmlReader.Create(stream))
using (var stream = response.Content)
{
var news = ParseRssItems(reader).ToList();
using (var reader = XmlReader.Create(stream))
{
var news = ParseRssItems(reader).ToList();
_json.SerializeToFile(news, path);
_json.SerializeToFile(news, path);
await CreateNotifications(news, lastUpdate, CancellationToken.None).ConfigureAwait(false);
await CreateNotifications(news, lastUpdate, CancellationToken.None).ConfigureAwait(false);
}
}
}
}