From cbfbb87926f38163236eb8d98ce6699e476c021a Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Tue, 21 Jun 2011 22:43:45 -0700 Subject: [PATCH] fixed issue where series controller was still going to db for every file. Increased log level tweaked connection string to sqlite --- NzbDrone.Core/Datastore/Connection.cs | 8 +++++--- NzbDrone.Core/Instrumentation/LogConfiguration.cs | 2 +- NzbDrone.Web/Controllers/SeriesController.cs | 14 ++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/NzbDrone.Core/Datastore/Connection.cs b/NzbDrone.Core/Datastore/Connection.cs index 186419b7d..c1a1b2676 100644 --- a/NzbDrone.Core/Datastore/Connection.cs +++ b/NzbDrone.Core/Datastore/Connection.cs @@ -21,7 +21,7 @@ namespace NzbDrone.Core.Datastore public static string GetConnectionString(string path) { - return String.Format("Data Source={0};Version=3;Cache Size=30000;", path); + return String.Format("Data Source={0};Version=3;Cache Size=30000;Pooling=true;Default Timeout=2", path); } public static String MainConnectionString @@ -44,10 +44,12 @@ namespace NzbDrone.Core.Datastore public static IDatabase GetPetaPocoDb(string connectionString, Boolean profiled = true) { MigrationsHelper.Run(connectionString, true); - DbConnection connection = new SQLiteConnection(connectionString); + var sqliteConnection = new SQLiteConnection(connectionString); + DbConnection connection = sqliteConnection; + if (profiled) { - connection = ProfiledDbConnection.Get(connection); + connection = ProfiledDbConnection.Get(sqliteConnection); } var db = new Database(connection); diff --git a/NzbDrone.Core/Instrumentation/LogConfiguration.cs b/NzbDrone.Core/Instrumentation/LogConfiguration.cs index 84ced7b24..49a4dc535 100644 --- a/NzbDrone.Core/Instrumentation/LogConfiguration.cs +++ b/NzbDrone.Core/Instrumentation/LogConfiguration.cs @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Instrumentation #endif var sonicTarget = CentralDispatch.NinjectKernel.Get(); LogManager.Configuration.AddTarget("DbLogger", sonicTarget); - LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, sonicTarget)); + LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, sonicTarget)); LogManager.Configuration.Reload(); } diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index 38e1eaa64..ed892ca8f 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -223,16 +223,14 @@ namespace NzbDrone.Web.Controllers var episodeFileId = 0; var episodePath = String.Empty; var episodeQuality = String.Empty; - EpisodeFile episodeFile = null; - if (e.EpisodeFileId > 0) - episodeFile = _mediaFileProvider.GetEpisodeFile(e.EpisodeFileId); - - if (episodeFile != null) + + + if (e.EpisodeFile != null) { - episodePath = episodeFile.Path; - episodeFileId = episodeFile.EpisodeFileId; - episodeQuality = episodeFile.Quality.ToString(); + episodePath = e.EpisodeFile.Path; + episodeFileId = e.EpisodeFile.EpisodeFileId; + episodeQuality = e.EpisodeFile.Quality.ToString(); } episodes.Add(new EpisodeModel