Performance improvement coming from the previous change

This commit is contained in:
tidusjar 2021-04-13 11:00:17 +01:00
commit 9c0d8f91e9

View file

@ -154,6 +154,9 @@ namespace Ombi.Core.Engine.V2
foreach (var tvMazeSearch in items)
{
if (settings.HideAvailableFromDiscover)
{
// To hide, we need to know if it's fully available, the only way to do this is to lookup it's episodes to check if we have every episode
var show = await Cache.GetOrAdd(nameof(GetShowInformation) + tvMazeSearch.Id.ToString(),
async () => await _movieApi.GetTVInfo(tvMazeSearch.Id.ToString()), DateTime.Now.AddHours(12));
foreach (var tvSeason in show.seasons.Where(x => x.season_number != 0)) // skip the first season
@ -165,6 +168,7 @@ namespace Ombi.Core.Engine.V2
MapSeasons(tvMazeSearch.SeasonRequests, tvSeason, seasonEpisodes);
}
}
var result = await ProcessResult(tvMazeSearch);
if (result == null || settings.HideAvailableFromDiscover && result.FullyAvailable)