Merge pull request #14653 from evan314159/coremigration

Delay initialization of singleton services during migration CoreInitialisation stage
This commit is contained in:
evan314159 2025-08-22 16:06:39 +08:00 committed by GitHub
parent ffb7753f8d
commit 7aa1c46447
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);