diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedApplicationStatus.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedApplicationStatus.cs index 86e4cd2a5..3c5d91ca1 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedApplicationStatus.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedApplicationStatus.cs @@ -14,14 +14,13 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers public void Clean() { - var mapper = _database.OpenConnection(); - + using var mapper = _database.OpenConnection(); mapper.Execute(@"DELETE FROM ""ApplicationStatus"" - WHERE ""Id"" IN ( - SELECT ""ApplicationStatus"".""Id"" FROM ""ApplicationStatus"" - LEFT OUTER JOIN ""Applications"" - ON ""ApplicationStatus"".""ProviderId"" = ""Applications"".""Id"" - WHERE ""Applications"".""Id"" IS NULL)"); + WHERE ""Id"" IN ( + SELECT ""ApplicationStatus"".""Id"" FROM ""ApplicationStatus"" + LEFT OUTER JOIN ""Applications"" + ON ""ApplicationStatus"".""ProviderId"" = ""Applications"".""Id"" + WHERE ""Applications"".""Id"" IS NULL)"); } } } diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedDownloadClientStatus.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedDownloadClientStatus.cs index 5a6af9fd8..fe1adfbd6 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedDownloadClientStatus.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedDownloadClientStatus.cs @@ -14,14 +14,13 @@ 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"" - LEFT OUTER JOIN ""DownloadClients"" - ON ""DownloadClientStatus"".""ProviderId"" = ""DownloadClients"".""Id"" - WHERE ""DownloadClients"".""Id"" IS NULL)"); + WHERE ""Id"" IN ( + SELECT ""DownloadClientStatus"".""Id"" FROM ""DownloadClientStatus"" + LEFT OUTER JOIN ""DownloadClients"" + ON ""DownloadClientStatus"".""ProviderId"" = ""DownloadClients"".""Id"" + WHERE ""DownloadClients"".""Id"" IS NULL)"); } } }