aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Program.cs
diff options
context:
space:
mode:
authorJPVenson <github@jpb.software>2025-02-21 11:08:09 +0000
committerJPVenson <github@jpb.software>2025-02-21 11:08:09 +0000
commit8c0b0d910229d7691b638d2aee5aa5a8aa07fe17 (patch)
tree2e4177bd57586f9e41747f582dddae9d70d78466 /Jellyfin.Server/Program.cs
parent963f2357a966dd7a5a6ab248155cc52ce066753b (diff)
parent712908d53c7ca38d13e03ea7809e0c40e862a5fb (diff)
Merge remote-tracking branch 'jellyfinorigin/master' into feature/10.10/DetachedMigration
Diffstat (limited to 'Jellyfin.Server/Program.cs')
-rw-r--r--Jellyfin.Server/Program.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 3d92caac4..7e50100b0 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -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;