mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 22:17:25 -04:00
Prevent additional errors on startup/shutdown (#6788)
This commit is contained in:
parent
a2127a48ef
commit
c16d71562e
1 changed files with 9 additions and 5 deletions
|
@ -224,12 +224,16 @@ namespace Jellyfin.Server
|
|||
}
|
||||
finally
|
||||
{
|
||||
_logger.LogInformation("Running query planner optimizations in the database... This might take a while");
|
||||
// Run before disposing the application
|
||||
using var context = appHost.Resolve<JellyfinDbProvider>().CreateContext();
|
||||
if (context.Database.IsSqlite())
|
||||
// Don't throw additional exception if startup failed.
|
||||
if (appHost.ServiceProvider != null)
|
||||
{
|
||||
context.Database.ExecuteSqlRaw("PRAGMA optimize");
|
||||
_logger.LogInformation("Running query planner optimizations in the database... This might take a while");
|
||||
// Run before disposing the application
|
||||
using var context = appHost.Resolve<JellyfinDbProvider>().CreateContext();
|
||||
if (context.Database.IsSqlite())
|
||||
{
|
||||
context.Database.ExecuteSqlRaw("PRAGMA optimize");
|
||||
}
|
||||
}
|
||||
|
||||
appHost.Dispose();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue