aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Server/Program.cs')
-rw-r--r--Jellyfin.Server/Program.cs20
1 files changed, 4 insertions, 16 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 3f73c15b4..fd23b7e25 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -157,7 +157,7 @@ namespace Jellyfin.Server
// Re-use the host service provider in the app host since ASP.NET doesn't allow a custom service collection.
appHost.ServiceProvider = host.Services;
- await appHost.InitializeServices().ConfigureAwait(false);
+ await appHost.InitializeServices(startupConfig).ConfigureAwait(false);
Migrations.MigrationRunner.Run(appHost, _loggerFactory);
try
@@ -194,23 +194,11 @@ namespace Jellyfin.Server
// Don't throw additional exception if startup failed.
if (appHost.ServiceProvider is not null)
{
- var isSqlite = false;
_logger.LogInformation("Running query planner optimizations in the database... This might take a while");
- // Run before disposing the application
- var context = await appHost.ServiceProvider.GetRequiredService<IDbContextFactory<JellyfinDbContext>>().CreateDbContextAsync().ConfigureAwait(false);
- await using (context.ConfigureAwait(false))
- {
- if (context.Database.IsSqlite())
- {
- isSqlite = true;
- await context.Database.ExecuteSqlRawAsync("PRAGMA optimize").ConfigureAwait(false);
- }
- }
- if (isSqlite)
- {
- SqliteConnection.ClearAllPools();
- }
+ var databaseProvider = appHost.ServiceProvider.GetRequiredService<IJellyfinDatabaseProvider>();
+
+ await databaseProvider.DisposeAsync().ConfigureAwait(false);
}
host?.Dispose();