Reduce cache size

This commit is contained in:
flightlevel 2019-04-14 11:59:48 +10:00
parent 2f96ffa15d
commit 40b0cdffc3
1 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ namespace Jackett.Common.Services
{
private readonly List<TrackerCache> cache = new List<TrackerCache>();
private readonly int MAX_RESULTS_PER_TRACKER = 1000;
private readonly TimeSpan AGE_LIMIT = new TimeSpan(7, 0, 0, 0);
private readonly TimeSpan AGE_LIMIT = new TimeSpan(0, 1, 0, 0);
public void CacheRssResults(IIndexer indexer, IEnumerable<ReleaseInfo> releases)
{
@ -44,7 +44,7 @@ namespace Jackett.Common.Services
// Prune cache
foreach(var tracker in cache)
{
tracker.Results = tracker.Results.OrderByDescending(i => i.Created).Take(MAX_RESULTS_PER_TRACKER).ToList();
tracker.Results = tracker.Results.Where(x => x.Created > DateTime.Now.Subtract(AGE_LIMIT)).OrderByDescending(i => i.Created).Take(MAX_RESULTS_PER_TRACKER).ToList();
}
}
}