aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-09-30 23:41:50 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-09-30 23:41:50 -0400
commitb1b0438d055273dc237b989ab2b9349056e711f2 (patch)
tree315098e3b4b9a3b7fb14f784becd1b39f5002831
parent5309f9d2bba3b39e0e1027d45c6d6723924d5075 (diff)
fix update level migration
-rw-r--r--MediaBrowser.Server.Startup.Common/ApplicationHost.cs16
-rw-r--r--MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs2
-rw-r--r--MediaBrowser.Server.Startup.Common/Migrations/IVersionMigration.cs5
-rw-r--r--MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs3
4 files changed, 16 insertions, 10 deletions
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
index 433855ea0..49013131e 100644
--- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
+++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
@@ -313,8 +313,13 @@ namespace MediaBrowser.Server.Startup.Common
/// <summary>
/// Runs the startup tasks.
/// </summary>
+ /// <summary>
+ /// Runs the startup tasks.
+ /// </summary>
public override async Task RunStartupTasks()
{
+ await PerformPreInitMigrations().ConfigureAwait(false);
+
if (ServerConfigurationManager.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion &&
ServerConfigurationManager.Configuration.IsStartupWizardCompleted)
{
@@ -345,6 +350,7 @@ namespace MediaBrowser.Server.Startup.Common
{
var name = entryPoint.GetType().FullName;
Logger.Info("Starting entry point {0}", name);
+ var now = DateTime.UtcNow;
try
{
entryPoint.Run();
@@ -353,7 +359,7 @@ namespace MediaBrowser.Server.Startup.Common
{
Logger.ErrorException("Error in {0}", ex, name);
}
- Logger.Info("Entry point completed: {0}", name);
+ Logger.Info("Entry point completed: {0}. Duration: {1} seconds", name, (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture));
}
Logger.Info("All entry points have started");
@@ -365,23 +371,21 @@ namespace MediaBrowser.Server.Startup.Common
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
- PerformPreInitMigrations();
-
return base.Init(progress);
}
- private void PerformPreInitMigrations()
+ private async Task PerformPreInitMigrations()
{
var migrations = new List<IVersionMigration>
{
- new UpdateLevelMigration(ServerConfigurationManager, this, HttpClient, JsonSerializer, _releaseAssetFilename)
+ new UpdateLevelMigration(ServerConfigurationManager, this, HttpClient, JsonSerializer, _releaseAssetFilename, Logger)
};
foreach (var task in migrations)
{
try
{
- task.Run();
+ await task.Run().ConfigureAwait(false);
}
catch (Exception ex)
{
diff --git a/MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs b/MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs
index f0cb9e84e..6bcdcca87 100644
--- a/MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs
+++ b/MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs
@@ -16,7 +16,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
_taskManager = taskManager;
}
- public void Run()
+ public async Task Run()
{
// If a forced migration is required, do that now
if (_config.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion)
diff --git a/MediaBrowser.Server.Startup.Common/Migrations/IVersionMigration.cs b/MediaBrowser.Server.Startup.Common/Migrations/IVersionMigration.cs
index a6a8c1a35..6ef08fae9 100644
--- a/MediaBrowser.Server.Startup.Common/Migrations/IVersionMigration.cs
+++ b/MediaBrowser.Server.Startup.Common/Migrations/IVersionMigration.cs
@@ -1,8 +1,9 @@
-
+using System.Threading.Tasks;
+
namespace MediaBrowser.Server.Startup.Common.Migrations
{
public interface IVersionMigration
{
- void Run();
+ Task Run();
}
}
diff --git a/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs b/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs
index 3ad5f577f..cd2122e57 100644
--- a/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs
+++ b/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs
@@ -1,5 +1,6 @@
using MediaBrowser.Controller.Configuration;
using System.Linq;
+using System.Threading.Tasks;
namespace MediaBrowser.Server.Startup.Common.Migrations
{
@@ -13,7 +14,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
_config = config;
}
- public void Run()
+ public async Task Run()
{
var migrationKey = this.GetType().FullName;
var migrationKeyList = _config.Configuration.Migrations.ToList();