mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
Added cleanup job for search history
New: Search History cleanup job will only keep the last week of results
This commit is contained in:
parent
c50ed82b7e
commit
b7408b726a
5 changed files with 159 additions and 0 deletions
45
NzbDrone.Core/Jobs/SearchHistoryCleanupJob.cs
Normal file
45
NzbDrone.Core/Jobs/SearchHistoryCleanupJob.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
namespace NzbDrone.Core.Jobs
|
||||
{
|
||||
public class SearchHistoryCleanupJob : IJob
|
||||
{
|
||||
private readonly SearchHistoryProvider _searchHistoryProvider;
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public SearchHistoryCleanupJob(SearchHistoryProvider searchHistoryProvider)
|
||||
{
|
||||
_searchHistoryProvider = searchHistoryProvider;
|
||||
}
|
||||
|
||||
public SearchHistoryCleanupJob()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Search History Cleanup"; }
|
||||
}
|
||||
|
||||
public TimeSpan DefaultInterval
|
||||
{
|
||||
get { return TimeSpan.FromHours(24); }
|
||||
}
|
||||
|
||||
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
||||
{
|
||||
Logger.Info("Running search history cleanup.");
|
||||
_searchHistoryProvider.Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue