Skip to content

The Free Software Media System - Server Backend & API

Use appHost.Resolve for accessing the context in Program.cs

Fernando Fernández59b67584fc18
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 6e87c8939f..3c0ee069d4 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -224,7 +224,7 @@ namespace Jellyfin.Server
{
_logger.LogInformation("Running query planner optimizations in the database... This might take a while");
// Run before disposing the application
- using var context = new JellyfinDbProvider(appHost.ServiceProvider, appPaths).CreateContext();
+ using var context = appHost.Resolve<JellyfinDbProvider>().CreateContext();
if (context.Database.IsSqlite())
{
context.Database.ExecuteSqlRaw("PRAGMA optimize");