Improved Indexer worker list result

This commit is contained in:
2025-07-19 21:21:28 +02:00
parent 87f644bebb
commit 07fa8945dc
4 changed files with 99 additions and 18 deletions

View File

@@ -41,7 +41,8 @@ public class CallsController : ControllerBase
CallListResult callListResult = new()
{
CallConfig = call.CallConfig,
IsRunning = call.IsRunning,
IsActive = call.IsEnabled,
IsExecuting = call.IsExecuting,
LastExecution = call.LastExecution,
LastSuccessfulExecution = call.LastSuccessfulExecution,
HealthStatus = call.HealthCheck().Status.ToString()

View File

@@ -35,6 +35,9 @@ public class WorkerController : ControllerBase
{
Name = worker.Name,
Script = worker.Config.Script,
IsExecuting = worker.IsExecuting,
LastExecution = worker.LastExecution,
LastSuccessfulExecution = worker.LastSuccessfulExecution,
HealthStatus = worker.HealthCheck().Status.ToString()
};
workerListResultList.Add(workerListResult);
@@ -65,7 +68,26 @@ public class WorkerController : ControllerBase
}
_logger.LogInformation("triggering worker {name}.", [name]);
ManualTriggerCallbackInfos callbackInfos = new();
worker.Scriptable.Update(callbackInfos);
lock (worker.Scriptable)
{
worker.IsExecuting = true;
worker.Scriptable.Update(callbackInfos);
worker.IsExecuting = false;
DateTime beforeExecution = DateTime.Now;
worker.IsExecuting = true;
try
{
worker.Scriptable.Update(callbackInfos);
}
finally
{
worker.IsExecuting = false;
worker.LastExecution = beforeExecution;
}
DateTime afterExecution = DateTime.Now;
WorkerCollection.UpdateWorkerTimestamps(worker, beforeExecution, afterExecution);
}
_logger.LogInformation("triggered worker {name}.", [name]);
return new WorkerTriggerUpdateResult { Success = true };