diff options
| author | JPVenson <github@jpb.email> | 2024-11-11 17:39:20 +0000 |
|---|---|---|
| committer | JPVenson <github@jpb.email> | 2024-11-11 17:39:20 +0000 |
| commit | bdab5e549eb158a9a58161e73cd0ef988ae37599 (patch) | |
| tree | 9c56f5f49690e57716ba47730c5779412a2a06b3 /Jellyfin.Server/Program.cs | |
| parent | 741397f1beff1844b4ca2f9c84ec55b169f6ac54 (diff) | |
Fixed WAL lock on program exit
Diffstat (limited to 'Jellyfin.Server/Program.cs')
| -rw-r--r-- | Jellyfin.Server/Program.cs | 8 |
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(); |
