1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

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

View File

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