mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-22 21:50:36 +02:00
fix update level migration
This commit is contained in:
parent
5309f9d2bb
commit
b1b0438d05
|
@ -310,11 +310,16 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
LogManager.ExceptionMessagePrefix = builder.ToString();
|
LogManager.ExceptionMessagePrefix = builder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Runs the startup tasks.
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs the startup tasks.
|
/// Runs the startup tasks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override async Task RunStartupTasks()
|
public override async Task RunStartupTasks()
|
||||||
{
|
{
|
||||||
|
await PerformPreInitMigrations().ConfigureAwait(false);
|
||||||
|
|
||||||
if (ServerConfigurationManager.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion &&
|
if (ServerConfigurationManager.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion &&
|
||||||
ServerConfigurationManager.Configuration.IsStartupWizardCompleted)
|
ServerConfigurationManager.Configuration.IsStartupWizardCompleted)
|
||||||
{
|
{
|
||||||
|
@ -345,6 +350,7 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
{
|
{
|
||||||
var name = entryPoint.GetType().FullName;
|
var name = entryPoint.GetType().FullName;
|
||||||
Logger.Info("Starting entry point {0}", name);
|
Logger.Info("Starting entry point {0}", name);
|
||||||
|
var now = DateTime.UtcNow;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
entryPoint.Run();
|
entryPoint.Run();
|
||||||
|
@ -353,7 +359,7 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error in {0}", ex, name);
|
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");
|
Logger.Info("All entry points have started");
|
||||||
|
|
||||||
|
@ -365,23 +371,21 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
|
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
|
||||||
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
|
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
|
||||||
|
|
||||||
PerformPreInitMigrations();
|
|
||||||
|
|
||||||
return base.Init(progress);
|
return base.Init(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PerformPreInitMigrations()
|
private async Task PerformPreInitMigrations()
|
||||||
{
|
{
|
||||||
var migrations = new List<IVersionMigration>
|
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)
|
foreach (var task in migrations)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
task.Run();
|
await task.Run().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||||
_taskManager = taskManager;
|
_taskManager = taskManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public async Task Run()
|
||||||
{
|
{
|
||||||
// If a forced migration is required, do that now
|
// If a forced migration is required, do that now
|
||||||
if (_config.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion)
|
if (_config.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||||
{
|
{
|
||||||
public interface IVersionMigration
|
public interface IVersionMigration
|
||||||
{
|
{
|
||||||
void Run();
|
Task Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||||
{
|
{
|
||||||
|
@ -13,7 +14,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public async Task Run()
|
||||||
{
|
{
|
||||||
var migrationKey = this.GetType().FullName;
|
var migrationKey = this.GetType().FullName;
|
||||||
var migrationKeyList = _config.Configuration.Migrations.ToList();
|
var migrationKeyList = _config.Configuration.Migrations.ToList();
|
||||||
|
|
Loading…
Reference in a new issue