diff options
| author | Mark Cilia Vincenti <markciliavincenti@gmail.com> | 2024-02-03 08:45:14 +0100 |
|---|---|---|
| committer | Mark Cilia Vincenti <markciliavincenti@gmail.com> | 2024-02-03 08:45:14 +0100 |
| commit | f26fc7dfb263765837dab7a0e4f661ff6bcd6597 (patch) | |
| tree | 54013c35dd2a1e8e5756b071681f37b31722ff52 /Emby.Server.Implementations/Library/LiveStreamHelper.cs | |
| parent | e47144e7c777751b03caf7cbb64cf93f92725725 (diff) | |
| parent | e4f715bbee26985ae7666e4c80282ac52e7fce73 (diff) | |
Merge changes
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"); } } |
