aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Program.cs
diff options
context:
space:
mode:
authorJPVenson <github@jpb.email>2025-01-26 20:45:28 +0000
committerJPVenson <github@jpb.email>2025-01-26 20:45:28 +0000
commitaa811eb1e3c78bdf8f4a751311c1bb6d639e851e (patch)
tree9c492fcac3f1db65c2d308eabf0012c0b2f3b696 /Jellyfin.Server/Program.cs
parentb318f335991167102a5fa8d65030d200bbec898d (diff)
Prepared Seperation of Database components for future multi provider support
Diffstat (limited to 'Jellyfin.Server/Program.cs')
-rw-r--r--Jellyfin.Server/Program.cs18
1 files changed, 3 insertions, 15 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 3f73c15b4..a6270aa93 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -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();