fix: service didn't use created singleton

This commit is contained in:
Timothy Schenk 2023-11-19 15:00:33 +01:00
parent 955fe83c03
commit 63309db7d9

View file

@ -42,7 +42,8 @@ builder.Services.AddDbContextPool<WonderkingContext>(o =>
builder.Services.AddSingleton<ILoggerFactory>(loggerFactory);
builder.Services.AddSingleton<PacketDistributorService>();
builder.Services.AddSingleton<ItemObjectPoolService>();
builder.Services.AddHostedService<ItemObjectPoolService>();
builder.Services.AddHostedService(provider =>
provider.GetService<ItemObjectPoolService>() ?? throw new InvalidOperationException());
builder.Services.AddHostedService(provider =>
provider.GetService<PacketDistributorService>() ?? throw new InvalidOperationException());
builder.Services.AddMassTransit(x =>