mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 07:46:05 -07:00
Reworked the cacher, fixed the memory leak. No more logging within tight loops.
This commit is contained in:
parent
98662ab74e
commit
4bccb8fcf0
4 changed files with 25 additions and 21 deletions
|
@ -951,11 +951,13 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
var seriesId = (int)Request.Query.tvId;
|
||||
var s = await SonarrService.GetSettingsAsync();
|
||||
var sonarrEnabled = s.Enabled;
|
||||
var allResults = await RequestService.GetAllAsync();
|
||||
|
||||
var seriesTask = Task.Run(
|
||||
() =>
|
||||
{
|
||||
if (s.Enabled)
|
||||
if (sonarrEnabled)
|
||||
{
|
||||
var allSeries = SonarrApi.GetSeries(s.ApiKey, s.FullUri);
|
||||
var selectedSeries = allSeries.FirstOrDefault(x => x.tvdbId == seriesId) ?? new Series();
|
||||
|
@ -972,9 +974,13 @@ namespace PlexRequests.UI.Modules
|
|||
var show = await Task.Run(() => TvApi.ShowLookupByTheTvDbId(seriesId));
|
||||
var seasons = await Task.Run(() => TvApi.EpisodeLookup(show.id));
|
||||
|
||||
var sonarrSeries = await seriesTask;
|
||||
var sonarrEp = SonarrApi.GetEpisodes(sonarrSeries.id.ToString(), s.ApiKey, s.FullUri);
|
||||
var sonarrEpisodes = sonarrEp?.ToList() ?? new List<SonarrEpisodes>();
|
||||
var sonarrEpisodes = new List<SonarrEpisodes>();
|
||||
if (sonarrEnabled)
|
||||
{
|
||||
var sonarrSeries = await seriesTask;
|
||||
var sonarrEp = SonarrApi.GetEpisodes(sonarrSeries.id.ToString(), s.ApiKey, s.FullUri);
|
||||
sonarrEpisodes = sonarrEp?.ToList() ?? new List<SonarrEpisodes>();
|
||||
}
|
||||
|
||||
foreach (var ep in seasons)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue