mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-27 10:58:44 +01:00
Merge pull request #5242 from jellyfin/cancellationtokens
Properly forward cancellationTokens
This commit is contained in:
@@ -102,10 +102,8 @@ namespace MediaBrowser.Providers.Manager
|
||||
{
|
||||
saveLocally = false;
|
||||
|
||||
var season = item as Season;
|
||||
|
||||
// If season is virtual under a physical series, save locally if using compatible convention
|
||||
if (season != null && _config.Configuration.ImageSavingConvention == ImageSavingConvention.Compatible)
|
||||
if (item is Season season && _config.Configuration.ImageSavingConvention == ImageSavingConvention.Compatible)
|
||||
{
|
||||
var series = season.Series;
|
||||
|
||||
@@ -138,7 +136,7 @@ namespace MediaBrowser.Providers.Manager
|
||||
var memoryStream = new MemoryStream();
|
||||
await using (source.ConfigureAwait(false))
|
||||
{
|
||||
await source.CopyToAsync(memoryStream).ConfigureAwait(false);
|
||||
await source.CopyToAsync(memoryStream, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
source = memoryStream;
|
||||
|
||||
@@ -756,7 +756,10 @@ namespace MediaBrowser.Providers.Music
|
||||
_stopWatchMusicBrainz.Restart();
|
||||
|
||||
using var request = new HttpRequestMessage(HttpMethod.Get, requestUrl);
|
||||
response = await _httpClientFactory.CreateClient(NamedClient.MusicBrainz).SendAsync(request).ConfigureAwait(false);
|
||||
response = await _httpClientFactory
|
||||
.CreateClient(NamedClient.MusicBrainz)
|
||||
.SendAsync(request, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
// We retry a finite number of times, and only whilst MB is indicating 503 (throttling).
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace MediaBrowser.Providers.Studios
|
||||
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(file));
|
||||
await using var response = await httpClient.GetStreamAsync(url).ConfigureAwait(false);
|
||||
await using var response = await httpClient.GetStreamAsync(url, cancellationToken).ConfigureAwait(false);
|
||||
await using var fileStream = new FileStream(file, FileMode.Create);
|
||||
await response.CopyToAsync(fileStream, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user