mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-31 21:08:27 +01:00
Merge remote-tracking branch 'jellyfinorigin/master' into feature/10.10/DetachedMigration
This commit is contained in:
@@ -15,6 +15,7 @@ using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -203,6 +204,7 @@ 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);
|
||||
@@ -210,9 +212,15 @@ namespace Jellyfin.Server
|
||||
{
|
||||
if (context.Database.IsSqlite())
|
||||
{
|
||||
isSqlite = true;
|
||||
await context.Database.ExecuteSqlRawAsync("PRAGMA optimize").ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (isSqlite)
|
||||
{
|
||||
SqliteConnection.ClearAllPools();
|
||||
}
|
||||
}
|
||||
|
||||
_appHost = null;
|
||||
|
||||
Reference in New Issue
Block a user