mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-13 03:43:17 +02:00
Move adding jobs to context to Job.Run (from Tranga.cs)
This commit is contained in:
parent
cc03b6fa9c
commit
19ff3f578a
@ -58,8 +58,9 @@ public abstract class Job
|
||||
|
||||
this.state = JobState.Running;
|
||||
context.SaveChanges();
|
||||
IEnumerable<Job> newJobs = RunInternal(context);
|
||||
Job[] newJobs = RunInternal(context).ToArray();
|
||||
this.state = JobState.Completed;
|
||||
context.Jobs.AddRange(newJobs);
|
||||
context.SaveChanges();
|
||||
return newJobs;
|
||||
}
|
||||
|
@ -113,7 +113,6 @@ public static class Tranga
|
||||
Thread t = new(() =>
|
||||
{
|
||||
IEnumerable<Job> newJobs = job.Run(serviceProvider);
|
||||
context.Jobs.AddRange(newJobs);
|
||||
});
|
||||
RunningJobs.Add(t, job);
|
||||
t.Start();
|
||||
|
Loading…
x
Reference in New Issue
Block a user