mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-14 04:13:18 +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;
|
this.state = JobState.Running;
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
IEnumerable<Job> newJobs = RunInternal(context);
|
Job[] newJobs = RunInternal(context).ToArray();
|
||||||
this.state = JobState.Completed;
|
this.state = JobState.Completed;
|
||||||
|
context.Jobs.AddRange(newJobs);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return newJobs;
|
return newJobs;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,6 @@ public static class Tranga
|
|||||||
Thread t = new(() =>
|
Thread t = new(() =>
|
||||||
{
|
{
|
||||||
IEnumerable<Job> newJobs = job.Run(serviceProvider);
|
IEnumerable<Job> newJobs = job.Run(serviceProvider);
|
||||||
context.Jobs.AddRange(newJobs);
|
|
||||||
});
|
});
|
||||||
RunningJobs.Add(t, job);
|
RunningJobs.Add(t, job);
|
||||||
t.Start();
|
t.Start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user