Sonarr pulls (#310)

* New: Speed up sqlite3 initialization by disabling unused features

Co-Authored-By: taloth <taloth@users.noreply.github.com>

* New: Debounce Command Notifications

Co-Authored-By: taloth <taloth@users.noreply.github.com>

* Changed: Refactored PendingRelease logic for performance

Co-Authored-By: taloth <taloth@users.noreply.github.com>

* Added: Indexes to speed up DecisionMaker performance.

Co-Authored-By: taloth <taloth@users.noreply.github.com>

* New: Cache EventAggregator Subscribers

Co-Authored-By: taloth <taloth@users.noreply.github.com>

* Fixed: Hide fallback pending releases if temporarily delayed

Co-Authored-By: taloth <taloth@users.noreply.github.com>
This commit is contained in:
Qstick
2018-04-22 09:35:37 -04:00
committed by Joseph Milazzo
parent e3f5ce771c
commit e06858e4bf
9 changed files with 261 additions and 122 deletions
@@ -51,6 +51,34 @@ namespace NzbDrone.Common.Extensions
}
}
public static Dictionary<TKey, TItem> ToDictionaryIgnoreDuplicates<TItem, TKey>(this IEnumerable<TItem> src, Func<TItem, TKey> keySelector)
{
var result = new Dictionary<TKey, TItem>();
foreach (var item in src)
{
var key = keySelector(item);
if (!result.ContainsKey(key))
{
result[key] = item;
}
}
return result;
}
public static Dictionary<TKey, TValue> ToDictionaryIgnoreDuplicates<TItem, TKey, TValue>(this IEnumerable<TItem> src, Func<TItem, TKey> keySelector, Func<TItem, TValue> valueSelector)
{
var result = new Dictionary<TKey, TValue>();
foreach (var item in src)
{
var key = keySelector(item);
if (!result.ContainsKey(key))
{
result[key] = valueSelector(item);
}
}
return result;
}
public static void AddIfNotNull<TSource>(this List<TSource> source, TSource item)
{
if (item == null)
@@ -81,4 +109,4 @@ namespace NzbDrone.Common.Extensions
return source.Select(predicate).ToList();
}
}
}
}