aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Program.cs
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2025-01-25 02:08:44 -0500
committerGitHub <noreply@github.com>2025-01-25 02:08:44 -0500
commit93b8eade617dbce16979bbada63b7faf44c5ce82 (patch)
tree5ef83a80b4ef1f713961d32ee6311c6033a3a9a9 /Jellyfin.Server/Program.cs
parent679ee960d346f24d7df559cbbaf95cf1c9567345 (diff)
parent64cf67f1ac758acd36db61432c97e434d9f9225d (diff)
Merge pull request #12798 from JPVenson/feature/EFUserData
Refactor library.db into jellyfin.db and EFCore
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 295fb8112..3f73c15b4 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -13,6 +13,7 @@ using Jellyfin.Server.Implementations;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@@ -193,6 +194,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);
@@ -200,9 +202,15 @@ namespace Jellyfin.Server
{
if (context.Database.IsSqlite())
{
+ isSqlite = true;
await context.Database.ExecuteSqlRawAsync("PRAGMA optimize").ConfigureAwait(false);
}
}
+
+ if (isSqlite)
+ {
+ SqliteConnection.ClearAllPools();
+ }
}
host?.Dispose();