From 5fb2c61c776867efa573cf58dcd02640e54a590e Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Tue, 21 Jun 2011 20:38:46 -0700 Subject: [PATCH] Fixed sab title issue Added profiling to OpenSharedconnection --- ...deProviderTest_GetEpisodesByParseResult.cs | 2 ++ NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs | 17 +++++++------ NzbDrone.Core/Providers/EpisodeProvider.cs | 1 + NzbDrone/Program.cs | 25 +++++++++++-------- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/NzbDrone.Core.Test/EpisodeProviderTest_GetEpisodesByParseResult.cs b/NzbDrone.Core.Test/EpisodeProviderTest_GetEpisodesByParseResult.cs index 1338bc061..150a931a7 100644 --- a/NzbDrone.Core.Test/EpisodeProviderTest_GetEpisodesByParseResult.cs +++ b/NzbDrone.Core.Test/EpisodeProviderTest_GetEpisodesByParseResult.cs @@ -51,6 +51,7 @@ namespace NzbDrone.Core.Test var ep = mocker.Resolve().GetEpisodesByParseResult(parseResult); ep.Should().HaveCount(1); + parseResult.EpisodeTitle.Should().Be(fakeEpisode.Title); ep.First().ShouldHave().AllPropertiesBut(e => e.Series); } @@ -138,6 +139,7 @@ namespace NzbDrone.Core.Test ep.Should().HaveCount(2); db.Fetch().Should().HaveCount(2); ep.First().ShouldHave().AllPropertiesBut(e => e.Series); + parseResult.EpisodeTitle.Should().Be(fakeEpisode.Title); } [Test] diff --git a/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs b/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs index dd96d0737..5a910df6d 100644 --- a/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs +++ b/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs @@ -355,16 +355,19 @@ namespace PetaPoco // Open a connection (can be nested) public void OpenSharedConnection() { - if (_sharedConnectionDepth == 0) + using (MvcMiniProfiler.MiniProfiler.StepStatic("OpenSharedConnection")) { - _sharedConnection = _factory.CreateConnection(); - _sharedConnection.ConnectionString = _connectionString; - _sharedConnection.Open(); + if (_sharedConnectionDepth == 0) + { + _sharedConnection = _factory.CreateConnection(); + _sharedConnection.ConnectionString = _connectionString; + _sharedConnection.Open(); - if (KeepConnectionAlive) - _sharedConnectionDepth++; // Make sure you call Dispose + if (KeepConnectionAlive) + _sharedConnectionDepth++; // Make sure you call Dispose + } + _sharedConnectionDepth++; } - _sharedConnectionDepth++; } /// diff --git a/NzbDrone.Core/Providers/EpisodeProvider.cs b/NzbDrone.Core/Providers/EpisodeProvider.cs index eca329ce8..08e9526a3 100644 --- a/NzbDrone.Core/Providers/EpisodeProvider.cs +++ b/NzbDrone.Core/Providers/EpisodeProvider.cs @@ -137,6 +137,7 @@ namespace NzbDrone.Core.Providers if (episodeInfo != null) { result.Add(episodeInfo); + parseResult.EpisodeTitle = episodeInfo.Title; } else { diff --git a/NzbDrone/Program.cs b/NzbDrone/Program.cs index da9cb4b26..72a9ea644 100644 --- a/NzbDrone/Program.cs +++ b/NzbDrone/Program.cs @@ -34,18 +34,21 @@ namespace NzbDrone #if DEBUG Attach(); #endif - try + if (Environment.UserInteractive) { - Logger.Info("Starting default browser. {0}",IISController.AppUrl); - Process.Start(IISController.AppUrl); - } - catch(Exception e) - { - Logger.ErrorException("Failed to open URL in default browser.", e); - } - while (true) - { - Console.ReadLine(); + try + { + Logger.Info("Starting default browser. {0}", IISController.AppUrl); + Process.Start(IISController.AppUrl); + } + catch (Exception e) + { + Logger.ErrorException("Failed to open URL in default browser.", e); + } + while (true) + { + Console.ReadLine(); + } } } catch (Exception e)