Fix More Live TV Warnings (#10818)
* Fix CA1819 in LiveTvManager * Call ConfigureAwait in ChannelManager
This commit is contained in:
parent
55916a09eb
commit
82f93afa22
|
@ -812,11 +812,16 @@ namespace Emby.Server.Implementations.Channels
|
|||
{
|
||||
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(cacheLength) > DateTime.UtcNow)
|
||||
{
|
||||
await using FileStream jsonStream = AsyncFile.OpenRead(cachePath);
|
||||
var cachedResult = await JsonSerializer.DeserializeAsync<ChannelItemResult>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (cachedResult is not null)
|
||||
var jsonStream = AsyncFile.OpenRead(cachePath);
|
||||
await using (jsonStream.ConfigureAwait(false))
|
||||
{
|
||||
return null;
|
||||
var cachedResult = await JsonSerializer
|
||||
.DeserializeAsync<ChannelItemResult>(jsonStream, _jsonOptions, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
if (cachedResult is not null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -835,11 +840,16 @@ namespace Emby.Server.Implementations.Channels
|
|||
{
|
||||
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(cacheLength) > DateTime.UtcNow)
|
||||
{
|
||||
await using FileStream jsonStream = AsyncFile.OpenRead(cachePath);
|
||||
var cachedResult = await JsonSerializer.DeserializeAsync<ChannelItemResult>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (cachedResult is not null)
|
||||
var jsonStream = AsyncFile.OpenRead(cachePath);
|
||||
await using (jsonStream.ConfigureAwait(false))
|
||||
{
|
||||
return null;
|
||||
var cachedResult = await JsonSerializer
|
||||
.DeserializeAsync<ChannelItemResult>(jsonStream, _jsonOptions, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
if (cachedResult is not null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -867,7 +877,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
throw new InvalidOperationException("Channel returned a null result from GetChannelItems");
|
||||
}
|
||||
|
||||
await CacheResponse(result, cachePath);
|
||||
await CacheResponse(result, cachePath).ConfigureAwait(false);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -883,8 +893,11 @@ namespace Emby.Server.Implementations.Channels
|
|||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
await using FileStream createStream = File.Create(path);
|
||||
await JsonSerializer.SerializeAsync(createStream, result, _jsonOptions).ConfigureAwait(false);
|
||||
var createStream = File.Create(path);
|
||||
await using (createStream.ConfigureAwait(false))
|
||||
{
|
||||
await JsonSerializer.SerializeAsync(createStream, result, _jsonOptions).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -105,9 +105,9 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
/// <value>The services.</value>
|
||||
public IReadOnlyList<ILiveTvService> Services => _services;
|
||||
|
||||
public ITunerHost[] TunerHosts => _tunerHosts;
|
||||
public IReadOnlyList<ITunerHost> TunerHosts => _tunerHosts;
|
||||
|
||||
public IListingsProvider[] ListingProviders => _listingProviders;
|
||||
public IReadOnlyList<IListingsProvider> ListingProviders => _listingProviders;
|
||||
|
||||
private LiveTvOptions GetConfiguration()
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <value>The services.</value>
|
||||
IReadOnlyList<ILiveTvService> Services { get; }
|
||||
|
||||
IListingsProvider[] ListingProviders { get; }
|
||||
IReadOnlyList<IListingsProvider> ListingProviders { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the new timer defaults asynchronous.
|
||||
|
|
Loading…
Reference in New Issue
Block a user