[postgres-Server-V2] fix: Updated Job logic to spawn a job only if a job with the same id is not already in the RunningJobs list

This commit is contained in:
Alessandro Benetton 2025-01-25 12:10:32 +01:00
parent ebe7e145aa
commit a713a006dd
No known key found for this signature in database
GPG Key ID: ED63A304CE2C0303

View File

@ -79,6 +79,9 @@ public static class Tranga
List<Job> runJobs = context.Jobs.Where(j => j.state <= JobState.Running).ToList().Where(j => j.NextExecution < DateTime.UtcNow).ToList();
foreach (Job job in runJobs)
{
// If the job is already running, skip it
if (RunningJobs.Values.Any(j => j.JobId == job.JobId)) continue;
Thread t = new (() =>
{
IEnumerable<Job> newJobs = job.Run(context);