mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Fixed: Moved main database cleanup to daily housekeeping to prevent windows service startup failure.
This commit is contained in:
parent
ceb06378ad
commit
000c172553
@ -78,12 +78,6 @@ public IDatabase Create(MigrationType migrationType = MigrationType.Main)
|
|||||||
return dataMapper;
|
return dataMapper;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (migrationType == MigrationType.Main)
|
|
||||||
{
|
|
||||||
db.Vacuum();
|
|
||||||
}
|
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
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;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Housekeeping
|
namespace NzbDrone.Core.Housekeeping
|
||||||
{
|
{
|
||||||
@ -11,11 +12,13 @@ public class HousekeepingService : IExecute<HousekeepingCommand>, IHandleAsync<A
|
|||||||
{
|
{
|
||||||
private readonly IEnumerable<IHousekeepingTask> _housekeepers;
|
private readonly IEnumerable<IHousekeepingTask> _housekeepers;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
private readonly IDatabase _mainDb;
|
||||||
|
|
||||||
public HousekeepingService(IEnumerable<IHousekeepingTask> housekeepers, Logger logger)
|
public HousekeepingService(IEnumerable<IHousekeepingTask> housekeepers, Logger logger, IDatabase mainDb)
|
||||||
{
|
{
|
||||||
_housekeepers = housekeepers;
|
_housekeepers = housekeepers;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_mainDb = mainDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Clean()
|
private void Clean()
|
||||||
@ -33,6 +36,10 @@ private void Clean()
|
|||||||
_logger.ErrorException("Error running housekeeping task: " + housekeeper.GetType().FullName, ex);
|
_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)
|
public void Execute(HousekeepingCommand message)
|
||||||
|
Loading…
Reference in New Issue
Block a user