Scoped PGSql Contexts for Threads

This commit is contained in:
2024-12-16 21:24:00 +01:00
parent c4fc2f436b
commit 03e89913e3
7 changed files with 47 additions and 8 deletions

View File

@ -128,8 +128,8 @@ using (var scope = app.Services.CreateScope())
TrangaSettings.Load();
Tranga.StartLogger();
Tranga.JobStarterThread.Start(app.Services.GetService<PgsqlContext>()!);
Tranga.NotificationSenderThread.Start(app.Services.GetService<PgsqlContext>()!);
Tranga.JobStarterThread.Start(app.Services.CreateScope().ServiceProvider.GetService<PgsqlContext>());
Tranga.NotificationSenderThread.Start(app.Services.CreateScope().ServiceProvider.GetService<PgsqlContext>());
app.UseCors("AllowAll");