JobContext per Job

This commit is contained in:
2025-05-18 15:21:59 +02:00
parent 96d5b09391
commit 3fe3fc09b0
2 changed files with 5 additions and 4 deletions

View File

@ -172,7 +172,9 @@ public static class Tranga
{
Thread t = new(() =>
{
job.Run(serviceProvider);
using IServiceScope jobScope = serviceProvider.CreateScope();
PgsqlContext jobContext = jobScope.ServiceProvider.GetRequiredService<PgsqlContext>();
job.Run(jobContext);
});
RunningJobs.Add(t, job);
t.Start();