Skip to content

Commit

Permalink
Merge pull request #10881 from TelepathicWalrus/fix-livetv-delay
Browse files Browse the repository at this point in the history
Fix long live tv load times, Fixes #10761
  • Loading branch information
Bond-009 committed Feb 1, 2024
2 parents f4d5538 + 7d6a03b commit a2fdec4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Emby.Server.Implementations/Library/LiveStreamHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,23 @@ public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudi

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 (Exception ex)
catch (IOException ex)
{
_logger.LogError(ex, "Error deserializing mediainfo cache");
_logger.LogDebug(ex, "Could not open cached media info");
}
finally
catch (Exception ex)
{
await jsonStream.DisposeAsync().ConfigureAwait(false);
_logger.LogError(ex, "Error opening cached media info");
}
}

Expand Down

0 comments on commit a2fdec4

Please sign in to comment.