From 00ae190a276f51f488752ab76cee131b16671fa2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 3 Feb 2016 16:56:00 -0500 Subject: [PATCH] update upgrade process --- .../HttpServer/HttpListenerHost.cs | 14 +++++++++++--- .../Persistence/CleanDatabaseScheduledTask.cs | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs index 78d7a480ea..d91d80dbd1 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -266,11 +266,19 @@ namespace MediaBrowser.Server.Implementations.HttpServer {".html", 0} }; - private bool EnableLogging(string url) + private bool EnableLogging(string url, string localPath) { var extension = GetExtension(url); - return string.IsNullOrWhiteSpace(extension) || !_skipLogExtensions.ContainsKey(extension); + if (string.IsNullOrWhiteSpace(extension) || !_skipLogExtensions.ContainsKey(extension)) + { + if (string.IsNullOrWhiteSpace(localPath) || localPath.IndexOf("system/ping", StringComparison.OrdinalIgnoreCase) == -1) + { + return true; + } + } + + return false; } private string GetExtension(string url) @@ -296,7 +304,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer var localPath = url.LocalPath; var urlString = url.OriginalString; - var enableLog = EnableLogging(urlString); + var enableLog = EnableLogging(urlString, localPath); if (enableLog) { diff --git a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs index 76a6e6d40c..f7c6fe5025 100644 --- a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs @@ -64,6 +64,8 @@ namespace MediaBrowser.Server.Implementations.Persistence public async Task Execute(CancellationToken cancellationToken, IProgress progress) { + OnProgress(0); + var innerProgress = new ActionableProgress(); innerProgress.RegisterAction(p => { @@ -146,6 +148,8 @@ namespace MediaBrowser.Server.Implementations.Persistence if (itemId != Guid.Empty) { + LogMessage(string.Format("Querying item {0}", itemId)); + // Somehow some invalid data got into the db. It probably predates the boundary checking var item = _libraryManager.GetItemById(itemId); @@ -153,6 +157,8 @@ namespace MediaBrowser.Server.Implementations.Persistence { try { + LogMessage(string.Format("Saving item {0}", itemId)); + await _itemRepo.SaveItem(item, cancellationToken).ConfigureAwait(false); } catch (OperationCanceledException) @@ -175,6 +181,14 @@ namespace MediaBrowser.Server.Implementations.Persistence progress.Report(100); } + private void LogMessage(string msg) + { + if (EnableUnavailableMessage) + { + _logger.Info(msg); + } + } + private async Task CleanDeadItems(CancellationToken cancellationToken, IProgress progress) { var itemIds = _libraryManager.GetItemIds(new InternalItemsQuery