update db migration

This commit is contained in:
Luke Pulverenti 2016-02-04 13:04:04 -05:00
parent e5f80aebd0
commit 94c70af4ad
5 changed files with 13 additions and 22 deletions

View file

@ -241,7 +241,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
} }
catch (Exception errorEx) catch (Exception errorEx)
{ {
_logger.ErrorException("Error this.ProcessRequest(context)(Exception while writing error to the response)", errorEx); //_logger.ErrorException("Error this.ProcessRequest(context)(Exception while writing error to the response)", errorEx);
} }
} }
@ -350,10 +350,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (!string.IsNullOrWhiteSpace(GlobalResponse)) if (!string.IsNullOrWhiteSpace(GlobalResponse))
{ {
httpRes.Write(GlobalResponse); if (string.Equals(GetExtension(urlString), "html", StringComparison.OrdinalIgnoreCase))
httpRes.ContentType = "text/plain"; {
httpRes.Write(GlobalResponse);
if (!string.Equals(GetExtension(urlString), "html", StringComparison.OrdinalIgnoreCase)) httpRes.ContentType = "text/plain";
}
else
{ {
httpRes.StatusCode = 503; httpRes.StatusCode = 503;
} }

View file

@ -67,7 +67,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
{ {
OnProgress(0); OnProgress(0);
// Ensure these objects are out of the database. // Ensure these objects are lazy loaded.
// Without this there is a deadlock that will need to be investigated
var rootChildren = _libraryManager.RootFolder.Children.ToList(); var rootChildren = _libraryManager.RootFolder.Children.ToList();
rootChildren = _libraryManager.GetUserRootFolder().Children.ToList(); rootChildren = _libraryManager.GetUserRootFolder().Children.ToList();
@ -182,14 +183,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
progress.Report(100); progress.Report(100);
} }
private void LogMessage(string msg)
{
if (EnableUnavailableMessage)
{
_logger.Info(msg);
}
}
private async Task CleanDeadItems(CancellationToken cancellationToken, IProgress<double> progress) private async Task CleanDeadItems(CancellationToken cancellationToken, IProgress<double> progress)
{ {
var itemIds = _libraryManager.GetItemIds(new InternalItemsQuery var itemIds = _libraryManager.GetItemIds(new InternalItemsQuery

View file

@ -583,22 +583,16 @@ namespace MediaBrowser.Server.Implementations.Persistence
CheckDisposed(); CheckDisposed();
_logger.Info("SaveItems waiting on write lock");
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false); await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
IDbTransaction transaction = null; IDbTransaction transaction = null;
try try
{ {
_logger.Info("SaveItems creating transaction");
transaction = _connection.BeginTransaction(); transaction = _connection.BeginTransaction();
foreach (var item in items) foreach (var item in items)
{ {
_logger.Info("Saving {0}", item.Id);
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
var index = 0; var index = 0;

View file

@ -317,7 +317,8 @@ namespace MediaBrowser.Server.Startup.Common
/// <returns>Task.</returns> /// <returns>Task.</returns>
public override async Task RunStartupTasks() public override async Task RunStartupTasks()
{ {
if (ServerConfigurationManager.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion) if (ServerConfigurationManager.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion &&
ServerConfigurationManager.Configuration.IsStartupWizardCompleted)
{ {
TaskManager.SuspendTriggers = true; TaskManager.SuspendTriggers = true;
} }

View file

@ -18,7 +18,8 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
public void Run() public void Run()
{ {
if (_config.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion) if (_config.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion &&
_config.Configuration.IsStartupWizardCompleted)
{ {
_taskManager.SuspendTriggers = true; _taskManager.SuspendTriggers = true;
CleanDatabaseScheduledTask.EnableUnavailableMessage = true; CleanDatabaseScheduledTask.EnableUnavailableMessage = true;