mirror of
https://github.com/C9Glax/tranga.git
synced 2025-05-22 14:13:01 +02:00
Logging for Jobs-Filtering
This commit is contained in:
parent
4bc70eca68
commit
5a6dc5a5b2
@ -107,14 +107,13 @@ public static class Tranga
|
|||||||
PgsqlContext context = scope.ServiceProvider.GetRequiredService<PgsqlContext>();
|
PgsqlContext context = scope.ServiceProvider.GetRequiredService<PgsqlContext>();
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{ Log.Debug("Loading Jobs...");
|
||||||
Log.Info("Loading Jobs...");
|
|
||||||
DateTime loadStart = DateTime.UtcNow;
|
DateTime loadStart = DateTime.UtcNow;
|
||||||
context.Jobs.Load();
|
context.Jobs.Load();
|
||||||
Log.Info("Updating Entries...");
|
Log.Debug("Updating Entries...");
|
||||||
foreach (EntityEntry entityEntry in context.ChangeTracker.Entries().ToArray())
|
foreach (EntityEntry entityEntry in context.ChangeTracker.Entries().ToArray())
|
||||||
entityEntry.Reload();
|
entityEntry.Reload();
|
||||||
Log.Info($"Jobs Loaded! (took {DateTime.UtcNow.Subtract(loadStart).TotalMilliseconds}ms)");
|
Log.Debug($"Jobs Loaded! (took {DateTime.UtcNow.Subtract(loadStart).TotalMilliseconds}ms)");
|
||||||
//Update finished Jobs to new states
|
//Update finished Jobs to new states
|
||||||
List<Job> completedJobs = context.Jobs.Local.Where(j => j.state == JobState.Completed).ToList();
|
List<Job> completedJobs = context.Jobs.Local.Where(j => j.state == JobState.Completed).ToList();
|
||||||
foreach (Job completedJob in completedJobs)
|
foreach (Job completedJob in completedJobs)
|
||||||
@ -135,6 +134,8 @@ public static class Tranga
|
|||||||
//Retrieve waiting and due Jobs
|
//Retrieve waiting and due Jobs
|
||||||
List<Job> runningJobs = context.Jobs.Local.Where(j => j.state == JobState.Running).ToList();
|
List<Job> runningJobs = context.Jobs.Local.Where(j => j.state == JobState.Running).ToList();
|
||||||
|
|
||||||
|
DateTime filterStart = DateTime.UtcNow;
|
||||||
|
Log.Debug("Filtering Jobs...");
|
||||||
List<MangaConnector> busyConnectors = GetBusyConnectors(runningJobs);
|
List<MangaConnector> busyConnectors = GetBusyConnectors(runningJobs);
|
||||||
|
|
||||||
List<Job> waitingJobs = GetWaitingJobs(context.Jobs.Local.ToList());
|
List<Job> waitingJobs = GetWaitingJobs(context.Jobs.Local.ToList());
|
||||||
@ -163,6 +164,8 @@ public static class Tranga
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
List<Job> startJobs = jobsWithoutDownloading.Concat(firstChapterPerConnector).ToList();
|
List<Job> startJobs = jobsWithoutDownloading.Concat(firstChapterPerConnector).ToList();
|
||||||
|
Log.Debug($"Jobs Filtered! (took {DateTime.UtcNow.Subtract(filterStart).TotalMilliseconds}ms)");
|
||||||
|
|
||||||
|
|
||||||
//Start Jobs that are allowed to run (preconditions match)
|
//Start Jobs that are allowed to run (preconditions match)
|
||||||
foreach (Job job in startJobs)
|
foreach (Job job in startJobs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user