mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-14 04:13:18 +02:00
[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:
parent
ebe7e145aa
commit
a713a006dd
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user