diff options
| author | evan314159 <110177090+evan314159@users.noreply.github.com> | 2025-08-22 16:06:39 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-22 10:06:39 +0200 |
| commit | 7aa1c4644771bfc49b00f817c237a1deddcef855 (patch) | |
| tree | 263550053fa352f56151acca960b421aa374c265 | |
| parent | ffb7753f8dfce3da0465b76daffb2060ab250ebd (diff) | |
Merge pull request #14653 from evan314159/coremigration
Delay initialization of singleton services during migration CoreInitialisation stage
| -rw-r--r-- | Jellyfin.Server/Migrations/Stages/CodeMigration.cs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Jellyfin.Server/Migrations/Stages/CodeMigration.cs b/Jellyfin.Server/Migrations/Stages/CodeMigration.cs index 264710bce..971b47608 100644 --- a/Jellyfin.Server/Migrations/Stages/CodeMigration.cs +++ b/Jellyfin.Server/Migrations/Stages/CodeMigration.cs @@ -34,12 +34,8 @@ internal class CodeMigration(Type migrationType, JellyfinMigrationAttribute meta { if (service.Lifetime == ServiceLifetime.Singleton && !service.ServiceType.IsGenericTypeDefinition) { - object? serviceInstance = serviceProvider.GetService(service.ServiceType); - if (serviceInstance != null) - { - childServiceCollection.AddSingleton(service.ServiceType, serviceInstance); - continue; - } + childServiceCollection.AddSingleton(service.ServiceType, _ => serviceProvider.GetService(service.ServiceType)!); + continue; } childServiceCollection.Add(service); |
