diff --git a/src/NzbDrone.Core/Datastore/DbFactory.cs b/src/NzbDrone.Core/Datastore/DbFactory.cs index 6d0e4a615..df7889d83 100644 --- a/src/NzbDrone.Core/Datastore/DbFactory.cs +++ b/src/NzbDrone.Core/Datastore/DbFactory.cs @@ -78,12 +78,6 @@ public IDatabase Create(MigrationType migrationType = MigrationType.Main) return dataMapper; }); - - if (migrationType == MigrationType.Main) - { - db.Vacuum(); - } - return db; } } diff --git a/src/NzbDrone.Core/Housekeeping/HousekeepingService.cs b/src/NzbDrone.Core/Housekeeping/HousekeepingService.cs index 26725a2c9..b48e953e0 100644 --- a/src/NzbDrone.Core/Housekeeping/HousekeepingService.cs +++ b/src/NzbDrone.Core/Housekeeping/HousekeepingService.cs @@ -4,6 +4,7 @@ using NzbDrone.Core.Lifecycle; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.Datastore; namespace NzbDrone.Core.Housekeeping { @@ -11,11 +12,13 @@ public class HousekeepingService : IExecute, IHandleAsync _housekeepers; private readonly Logger _logger; + private readonly IDatabase _mainDb; - public HousekeepingService(IEnumerable housekeepers, Logger logger) + public HousekeepingService(IEnumerable housekeepers, Logger logger, IDatabase mainDb) { _housekeepers = housekeepers; _logger = logger; + _mainDb = mainDb; } private void Clean() @@ -33,6 +36,10 @@ private void Clean() _logger.ErrorException("Error running housekeeping task: " + housekeeper.GetType().FullName, ex); } } + + // Vacuuming the log db isn't needed since that's done hourly at the TrimLogCommand. + _logger.Debug("Compressing main database after housekeeping"); + _mainDb.Vacuum(); } public void Execute(HousekeepingCommand message)