Reload Jobs loaded in context

This commit is contained in:
Glax 2025-05-09 12:31:40 +02:00
parent 0f6c060026
commit 694b88d200

View File

@ -5,6 +5,7 @@ using API.Schema.NotificationConnectors;
using log4net; using log4net;
using log4net.Config; using log4net.Config;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
namespace API; namespace API;
@ -119,6 +120,8 @@ public static class Tranga
Log.Info("JobStarter Thread running."); Log.Info("JobStarter Thread running.");
while (true) while (true)
{ {
foreach (EntityEntry entityEntry in context.ChangeTracker.Entries().ToArray())
entityEntry.Reload();
//Update finished Jobs to new states //Update finished Jobs to new states
List<Job> completedJobs = context.Jobs.Where(j => j.state == JobState.Completed).ToList(); List<Job> completedJobs = context.Jobs.Where(j => j.state == JobState.Completed).ToList();
foreach (Job completedJob in completedJobs) foreach (Job completedJob in completedJobs)