diff options
| author | Bond-009 <bond.009@outlook.com> | 2024-02-01 21:08:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-01 21:08:21 +0100 |
| commit | a2fdec4363dd14b2a4d17d880f71ef8cdb7bf57b (patch) | |
| tree | 6eb8ceae91c32a81a1ab72f953c71e04314a5712 /Emby.Server.Implementations/Library/LiveStreamHelper.cs | |
| parent | f4d553877cec85bb27798c3320178bc1a65842f8 (diff) | |
| parent | 7d6a03bad6b8baacb83625be32e708090722fe10 (diff) | |
Merge pull request #10881 from TelepathicWalrus/fix-livetv-delay
Fix long live tv load times, Fixes #10761
Diffstat (limited to 'Emby.Server.Implementations/Library/LiveStreamHelper.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/LiveStreamHelper.cs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Library/LiveStreamHelper.cs b/Emby.Server.Implementations/Library/LiveStreamHelper.cs index 59d705ace..d4aeae41a 100644 --- a/Emby.Server.Implementations/Library/LiveStreamHelper.cs +++ b/Emby.Server.Implementations/Library/LiveStreamHelper.cs @@ -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 (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"); } } |
