mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 09:04:42 +01:00
improve httpclient resource disposal
This commit is contained in:
@@ -175,13 +175,24 @@ namespace Emby.Server.Implementations.Updates
|
||||
{ "systemid", _applicationHost.SystemId }
|
||||
};
|
||||
|
||||
using (var json = await _httpClient.Post("https://www.mb3admin.com/admin/service/package/retrieveall?includeAllRuntimes=true", data, cancellationToken).ConfigureAwait(false))
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
Url = "https://www.mb3admin.com/admin/service/package/retrieveall?includeAllRuntimes=true",
|
||||
CancellationToken = cancellationToken
|
||||
};
|
||||
|
||||
var packages = _jsonSerializer.DeserializeFromStream<PackageInfo[]>(json);
|
||||
options.SetPostData(data);
|
||||
|
||||
return FilterPackages(packages, packageType, applicationVersion);
|
||||
using (var response = await _httpClient.SendAsync(options, "POST").ConfigureAwait(false))
|
||||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var packages = _jsonSerializer.DeserializeFromStream<PackageInfo[]>(json);
|
||||
|
||||
return FilterPackages(packages, packageType, applicationVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user