aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Startup.Common
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Startup.Common')
-rw-r--r--MediaBrowser.Server.Startup.Common/ApplicationHost.cs5
-rw-r--r--MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs3
2 files changed, 7 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
index f75aeebdd..7f79653af 100644
--- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
+++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
@@ -317,6 +317,11 @@ namespace MediaBrowser.Server.Startup.Common
/// <returns>Task.</returns>
public override async Task RunStartupTasks()
{
+ if (ServerConfigurationManager.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion)
+ {
+ TaskManager.SuspendTriggers = true;
+ }
+
await base.RunStartupTasks().ConfigureAwait(false);
Logger.Info("ServerId: {0}", SystemId);
diff --git a/MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs b/MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs
index 1df49845b..959543893 100644
--- a/MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs
+++ b/MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs
@@ -20,13 +20,14 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
{
if (_config.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion)
{
+ _taskManager.SuspendTriggers = true;
CleanDatabaseScheduledTask.EnableUnavailableMessage = true;
Task.Run(async () =>
{
await Task.Delay(1000).ConfigureAwait(false);
- _taskManager.QueueScheduledTask<CleanDatabaseScheduledTask>();
+ _taskManager.Execute<CleanDatabaseScheduledTask>();
});
}
}