From 43b4262e14116b15e2a3df1c3d196f567a0738cd Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 19 May 2013 18:07:26 -0700 Subject: [PATCH] updates static resourceprovider with better logging. --- .../Frontend/StaticResourceProvider.cs | 20 +++++++++---------- NzbDrone.Core/Update/UpdateService.cs | 2 ++ NzbDrone.Update/Providers/UpdateProvider.cs | 3 --- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/NzbDrone.Api/Frontend/StaticResourceProvider.cs b/NzbDrone.Api/Frontend/StaticResourceProvider.cs index a3334edc8..66bbaaedf 100644 --- a/NzbDrone.Api/Frontend/StaticResourceProvider.cs +++ b/NzbDrone.Api/Frontend/StaticResourceProvider.cs @@ -35,20 +35,20 @@ namespace NzbDrone.Api.Frontend return null; } - foreach (var requestMapper in _requestMappers) - { - if (requestMapper.CanHandle(path)) - { - var filePath = requestMapper.Map(path); + var mapper = _requestMappers.SingleOrDefault(m => m.CanHandle(path)); - if (_diskProvider.FileExists(filePath)) - { - return new StreamResponse(() => File.OpenRead(filePath), MimeTypes.GetMimeType(filePath)); - } + if (mapper != null) + { + var filePath = mapper.Map(path); + + if (_diskProvider.FileExists(filePath)) + { + return new StreamResponse(() => File.OpenRead(filePath), MimeTypes.GetMimeType(filePath)); } + + _logger.Warn("File {0} not found", filePath); } - _logger.Warn("Couldn't find a matching file for: {0}", path); return null; } } diff --git a/NzbDrone.Core/Update/UpdateService.cs b/NzbDrone.Core/Update/UpdateService.cs index a0a716b4e..bfde1c213 100644 --- a/NzbDrone.Core/Update/UpdateService.cs +++ b/NzbDrone.Core/Update/UpdateService.cs @@ -81,6 +81,8 @@ namespace NzbDrone.Core.Update var process = _processProvider.Start(startInfo); _processProvider.WaitForExit(process); + + _logger.Error("Update process failed"); } public Dictionary GetUpdateLogFiles() diff --git a/NzbDrone.Update/Providers/UpdateProvider.cs b/NzbDrone.Update/Providers/UpdateProvider.cs index e56215fcd..2837130c3 100644 --- a/NzbDrone.Update/Providers/UpdateProvider.cs +++ b/NzbDrone.Update/Providers/UpdateProvider.cs @@ -81,9 +81,6 @@ namespace NzbDrone.Update.Providers try { _diskProvider.CopyDirectory(_environmentProvider.GetUpdatePackageFolder(), targetFolder); - - logger.Trace("Deleting Update Package."); - _diskProvider.DeleteFolder(_environmentProvider.GetUpdatePackageFolder(), true); } catch (Exception e) {