From ee227e3b1d10bbff1863440eeb5cce3ee6be401e Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Wed, 12 May 2021 23:55:52 +0200 Subject: [PATCH] Fixed timing issues fixes #4487 --- src/Marr.Data/Reflection/SimpleReflectionStrategy.cs | 10 ++++------ src/NzbDrone.Core/Tv/SeriesScannedHandler.cs | 8 +++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Marr.Data/Reflection/SimpleReflectionStrategy.cs b/src/Marr.Data/Reflection/SimpleReflectionStrategy.cs index 25b25de5b..df73bc593 100644 --- a/src/Marr.Data/Reflection/SimpleReflectionStrategy.cs +++ b/src/Marr.Data/Reflection/SimpleReflectionStrategy.cs @@ -1,5 +1,5 @@ using System; -using System.Collections.Generic; +using System.Collections.Concurrent; using System.Linq.Expressions; using System.Reflection; @@ -7,11 +7,9 @@ namespace Marr.Data.Reflection { public class SimpleReflectionStrategy : IReflectionStrategy { - - private static readonly Dictionary MemberCache = new Dictionary(); - private static readonly Dictionary GetterCache = new Dictionary(); - private static readonly Dictionary SetterCache = new Dictionary(); - + private static readonly ConcurrentDictionary MemberCache = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary GetterCache = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary SetterCache = new ConcurrentDictionary(); private static MemberInfo GetMember(Type entityType, string name) { diff --git a/src/NzbDrone.Core/Tv/SeriesScannedHandler.cs b/src/NzbDrone.Core/Tv/SeriesScannedHandler.cs index 804f6a4dc..3f7e5d36b 100644 --- a/src/NzbDrone.Core/Tv/SeriesScannedHandler.cs +++ b/src/NzbDrone.Core/Tv/SeriesScannedHandler.cs @@ -31,20 +31,22 @@ namespace NzbDrone.Core.Tv private void HandleScanEvents(Series series) { - if (series.AddOptions == null) + var addOptions = series.AddOptions; + + if (addOptions == null) { _episodeAddedService.SearchForRecentlyAdded(series.Id); return; } _logger.Info("[{0}] was recently added, performing post-add actions", series.Title); - _episodeMonitoredService.SetEpisodeMonitoredStatus(series, series.AddOptions); + _episodeMonitoredService.SetEpisodeMonitoredStatus(series, addOptions); // If both options are enabled search for the whole series, which will only include monitored episodes. // This way multiple searches for the same season are skipped, though a season that can't be upgraded may be // searched, but the logs will be more explicit. - if (series.AddOptions.SearchForMissingEpisodes && series.AddOptions.SearchForCutoffUnmetEpisodes) + if (addOptions.SearchForMissingEpisodes && addOptions.SearchForCutoffUnmetEpisodes) { _commandQueueManager.Push(new SeriesSearchCommand(series.Id)); }