mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-07 18:24:19 -04:00
Don't dispose HttpClients
This commit is contained in:
parent
604f4b2742
commit
584636bdd8
@ -599,8 +599,9 @@ namespace Jellyfin.LiveTv.Listings
|
|||||||
CancellationToken cancellationToken,
|
CancellationToken cancellationToken,
|
||||||
HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
|
HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
|
||||||
{
|
{
|
||||||
using var client = _httpClientFactory.CreateClient(NamedClient.Default);
|
using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||||
using var response = await client.SendAsync(message, completionOption, cancellationToken).ConfigureAwait(false);
|
.SendAsync(message, completionOption, cancellationToken)
|
||||||
|
.ConfigureAwait(false);
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
return await response.Content.ReadFromJsonAsync<T>(_jsonOptions, cancellationToken).ConfigureAwait(false);
|
return await response.Content.ReadFromJsonAsync<T>(_jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||||
@ -665,8 +666,7 @@ namespace Jellyfin.LiveTv.Listings
|
|||||||
using var message = new HttpRequestMessage(HttpMethod.Put, ApiUrl + "/lineups/" + info.ListingsId);
|
using var message = new HttpRequestMessage(HttpMethod.Put, ApiUrl + "/lineups/" + info.ListingsId);
|
||||||
message.Headers.TryAddWithoutValidation("token", token);
|
message.Headers.TryAddWithoutValidation("token", token);
|
||||||
|
|
||||||
using var client = _httpClientFactory.CreateClient(NamedClient.Default);
|
using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||||
using var response = await client
|
|
||||||
.SendAsync(message, HttpCompletionOption.ResponseHeadersRead, cancellationToken)
|
.SendAsync(message, HttpCompletionOption.ResponseHeadersRead, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user