-
-
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -48,20 +48,29 @@ 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"); | ||||||||||||||||||||||||||||||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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 commentThe reason will be displayed to describe this comment to others. Learn more. Ok, just wasn't sure if the |
||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
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"); | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
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.