aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2024-01-10 16:54:33 -0500
committerPatrick Barron <barronpm@gmail.com>2024-01-12 11:35:34 -0500
commitbbce1beb1d136d849141a5a5e634fed729fc6698 (patch)
tree3c5300e9d3f6de2475a571f24ce27d62e016a50d /src
parent82df226246515991b5a7dac576972ee4e6c0a646 (diff)
Don't re-use HttpRequestMessage on re-try in SchedulesDirect
Diffstat (limited to 'src')
-rw-r--r--src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs b/src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs
index 3b20cd160..5c0e96c67 100644
--- a/src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs
+++ b/src/Jellyfin.LiveTv/Listings/SchedulesDirect.cs
@@ -598,14 +598,14 @@ namespace Jellyfin.LiveTv.Listings
}
private async Task<HttpResponseMessage> Send(
- HttpRequestMessage options,
+ HttpRequestMessage message,
bool enableRetry,
ListingsProviderInfo providerInfo,
CancellationToken cancellationToken,
HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
- var response = await _httpClientFactory.CreateClient(NamedClient.Default)
- .SendAsync(options, completionOption, cancellationToken).ConfigureAwait(false);
+ using var client = _httpClientFactory.CreateClient(NamedClient.Default);
+ var response = await client.SendAsync(message, completionOption, cancellationToken).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return response;
@@ -625,8 +625,13 @@ namespace Jellyfin.LiveTv.Listings
#pragma warning restore IDISP016, IDISP017
_tokens.Clear();
- options.Headers.TryAddWithoutValidation("token", await GetToken(providerInfo, cancellationToken).ConfigureAwait(false));
- return await Send(options, false, providerInfo, cancellationToken).ConfigureAwait(false);
+ using var retryMessage = new HttpRequestMessage(message.Method, message.RequestUri);
+ retryMessage.Content = message.Content;
+ retryMessage.Headers.TryAddWithoutValidation(
+ "token",
+ await GetToken(providerInfo, cancellationToken).ConfigureAwait(false));
+
+ return await Send(retryMessage, false, providerInfo, cancellationToken).ConfigureAwait(false);
}
private async Task<string> GetTokenInternal(