Only vacuum the DB in production

This commit is contained in:
Mark McDowall 2014-05-16 07:35:41 -07:00
parent 1d4837a5f2
commit 0a1db9d071
1 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Lifecycle; using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
@ -14,7 +15,7 @@ namespace NzbDrone.Core.Housekeeping
private readonly Logger _logger; private readonly Logger _logger;
private readonly IDatabase _mainDb; private readonly IDatabase _mainDb;
public HousekeepingService(IEnumerable<IHousekeepingTask> housekeepers, Logger logger, IDatabase mainDb) public HousekeepingService(IEnumerable<IHousekeepingTask> housekeepers, IDatabase mainDb, Logger logger)
{ {
_housekeepers = housekeepers; _housekeepers = housekeepers;
_logger = logger; _logger = logger;
@ -37,9 +38,13 @@ namespace NzbDrone.Core.Housekeeping
} }
} }
// Vacuuming the log db isn't needed since that's done hourly at the TrimLogCommand. //Only Vaccuum the DB in production
_logger.Debug("Compressing main database after housekeeping"); if (RuntimeInfo.IsProduction)
_mainDb.Vacuum(); {
// 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) public void Execute(HousekeepingCommand message)