From b7c5639a9dbe48e6b43e3b8dd858927c9399e980 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sun, 11 Mar 2018 19:38:47 +0100 Subject: [PATCH] Speed up sqlite3 initialization by disabling unused features. --- src/NzbDrone.Core/Datastore/DbFactory.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/NzbDrone.Core/Datastore/DbFactory.cs b/src/NzbDrone.Core/Datastore/DbFactory.cs index d2a239d6d..e49df1c21 100644 --- a/src/NzbDrone.Core/Datastore/DbFactory.cs +++ b/src/NzbDrone.Core/Datastore/DbFactory.cs @@ -27,10 +27,20 @@ namespace NzbDrone.Core.Datastore static DbFactory() { + InitializeEnvironment(); + MapRepository.Instance.ReflectionStrategy = new SimpleReflectionStrategy(); TableMapping.Map(); } + private static void InitializeEnvironment() + { + // Speed up sqlite3 initialization since we don't use the config file and can't rely on preloading. + Environment.SetEnvironmentVariable("No_Expand", "true"); + Environment.SetEnvironmentVariable("No_SQLiteXmlConfigFile", "true"); + Environment.SetEnvironmentVariable("No_PreLoadSQLite", "true"); + } + public static void RegisterDatabase(IContainer container) { var mainDb = new MainDatabase(container.Resolve().Create());