Merge pull request #10881 from TelepathicWalrus/fix-livetv-delay

Fix long live tv load times, Fixes #10761
This commit is contained in:
Bond-009 2024-02-01 21:08:21 +01:00 committed by GitHub
commit a2fdec4363
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,20 +48,23 @@ namespace Emby.Server.Implementations.Library
if (!string.IsNullOrEmpty(cacheKey))
{
FileStream jsonStream = AsyncFile.OpenRead(cacheFilePath);
try
{
mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
FileStream jsonStream = AsyncFile.OpenRead(cacheFilePath);
// _logger.LogDebug("Found cached media info");
await using (jsonStream.ConfigureAwait(false))
{
mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
// _logger.LogDebug("Found cached media info");
}
}
catch (IOException ex)
{
_logger.LogDebug(ex, "Could not open cached media info");
}
catch (Exception ex)
{
_logger.LogError(ex, "Error deserializing mediainfo cache");
}
finally
{
await jsonStream.DisposeAsync().ConfigureAwait(false);
_logger.LogError(ex, "Error opening cached media info");
}
}