mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-30 15:37:55 +02: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:
@@ -117,5 +117,19 @@ namespace NzbDrone.Core.Providers
|
||||
logger.Info("Forcing Download of: {0}", item.ReportTitle);
|
||||
_downloadProvider.DownloadReport(parseResult);
|
||||
}
|
||||
|
||||
public virtual void Cleanup()
|
||||
{
|
||||
var ids = _database.Fetch<int>("SELECT Id FROM SearchHistory WHERE SearchTime > @0", DateTime.Now.AddDays(7));
|
||||
|
||||
if (ids.Any())
|
||||
{
|
||||
logger.Trace("Deleting old search items");
|
||||
_database.Execute("DELETE FROM SearchHistoryItems WHERE SearchHistoryId IN (@0)", ids);
|
||||
|
||||
logger.Trace("Deleting old search results");
|
||||
_database.Execute("DELETE FROM SearchHistory WHERE Id IN (@0)", ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user