-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix long live tv load times, Fixes #10761 #10881
Conversation
In Emby.Server.Implementations/Library/MediaSourceManager.cs there is the same function with the same |
try | ||
{ | ||
mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false); | ||
// _logger.LogDebug("Found cached media info"); | ||
} | ||
catch (Exception ex) | ||
{ | ||
_logger.LogError(ex, "Error deserializing mediainfo cache"); | ||
} | ||
|
||
await jsonStream.DisposeAsync().ConfigureAwait(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try | |
{ | |
mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false); | |
// _logger.LogDebug("Found cached media info"); | |
} | |
catch (Exception ex) | |
{ | |
_logger.LogError(ex, "Error deserializing mediainfo cache"); | |
} | |
await jsonStream.DisposeAsync().ConfigureAwait(false); | |
await using (jsonStream.ConfigureAwait(false)) | |
{ | |
mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false); | |
// _logger.LogDebug("Found cached media info"); | |
} |
IMO converting the nested try-catch into a using statement makes more sense. I believe the new disposable analyzer would flag this, so we'd need to do it eventually anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, just wasn't sure if the DisposeAsync
line was needed but i assume the using
will dispose of it even if this fails. This does look much nicer than nested try catch. Ive updated PR.
await using (jsonStream.ConfigureAwait(false)) | ||
{ | ||
mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false); | ||
// _logger.LogDebug("Found cached media info"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the commented logDebug
? If so it was there before so I left it there.
Fix long live tv load times, Fixes jellyfin#10761
Second attempt at fixing this issue, this time i actually read the logs! Adds an extra test to check that the cached media info file can be read. This allows the rest of the function to run if the file doesn't exist.
Changes
Add extra try/catch to stop errors if trying to read cached media info file that doesn't exist
Issues
Fixes #10761