Close database connections in housekeeping tasks

Co-authored-by: ferencmarkizay <ferencmarkizay@gmail.com>
This commit is contained in:
Bogdan 2023-06-16 01:08:24 +03:00 committed by Mark McDowall
parent b48fe6e633
commit 9af6d1b9d9
2 changed files with 12 additions and 14 deletions

View File

@ -16,8 +16,7 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
public void Clean()
{
var mapper = _database.OpenConnection();
using var mapper = _database.OpenConnection();
mapper.Execute(@"DELETE FROM PendingReleases
WHERE Added < @TwoWeeksAgo
AND REASON IN @Reasons",

View File

@ -14,8 +14,7 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
public void Clean()
{
var mapper = _database.OpenConnection();
using var mapper = _database.OpenConnection();
mapper.Execute(@"DELETE FROM DownloadClientStatus
WHERE Id IN (
SELECT DownloadClientStatus.Id FROM DownloadClientStatus