mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
Don't re-use HttpRequestMessage on re-try in SchedulesDirect
This commit is contained in:
parent
82df226246
commit
bbce1beb1d
1 changed files with 10 additions and 5 deletions
|
@ -598,14 +598,14 @@ namespace Jellyfin.LiveTv.Listings
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<HttpResponseMessage> Send(
|
private async Task<HttpResponseMessage> Send(
|
||||||
HttpRequestMessage options,
|
HttpRequestMessage message,
|
||||||
bool enableRetry,
|
bool enableRetry,
|
||||||
ListingsProviderInfo providerInfo,
|
ListingsProviderInfo providerInfo,
|
||||||
CancellationToken cancellationToken,
|
CancellationToken cancellationToken,
|
||||||
HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
|
HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
|
||||||
{
|
{
|
||||||
var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
using var client = _httpClientFactory.CreateClient(NamedClient.Default);
|
||||||
.SendAsync(options, completionOption, cancellationToken).ConfigureAwait(false);
|
var response = await client.SendAsync(message, completionOption, cancellationToken).ConfigureAwait(false);
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
return response;
|
return response;
|
||||||
|
@ -625,8 +625,13 @@ namespace Jellyfin.LiveTv.Listings
|
||||||
#pragma warning restore IDISP016, IDISP017
|
#pragma warning restore IDISP016, IDISP017
|
||||||
|
|
||||||
_tokens.Clear();
|
_tokens.Clear();
|
||||||
options.Headers.TryAddWithoutValidation("token", await GetToken(providerInfo, cancellationToken).ConfigureAwait(false));
|
using var retryMessage = new HttpRequestMessage(message.Method, message.RequestUri);
|
||||||
return await Send(options, false, providerInfo, cancellationToken).ConfigureAwait(false);
|
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(
|
private async Task<string> GetTokenInternal(
|
||||||
|
|
Loading…
Reference in a new issue