瀏覽代碼

Don't dispose HttpClients

Patrick Barron 1 年之前
父節點
當前提交
584636bdd8
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs

+ 4 - 4
src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs

@@ -599,8 +599,9 @@ namespace Jellyfin.LiveTv.Listings
             CancellationToken cancellationToken,
             HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
         {
-            using var client = _httpClientFactory.CreateClient(NamedClient.Default);
-            using var response = await client.SendAsync(message, completionOption, cancellationToken).ConfigureAwait(false);
+            using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
+                .SendAsync(message, completionOption, cancellationToken)
+                .ConfigureAwait(false);
             if (response.IsSuccessStatusCode)
             {
                 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);
             message.Headers.TryAddWithoutValidation("token", token);
 
-            using var client = _httpClientFactory.CreateClient(NamedClient.Default);
-            using var response = await client
+            using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
                 .SendAsync(message, HttpCompletionOption.ResponseHeadersRead, cancellationToken)
                 .ConfigureAwait(false);