Fix styling, job endpoints, and infinite worker loops

This commit is contained in:
Richard
2026-07-07 09:21:37 +02:00
parent 10eefd3546
commit 2c7c643fdb
4 changed files with 19 additions and 9 deletions
@@ -34,9 +34,9 @@ public class TradeHistoryWorker : BackgroundService
while (!stoppingToken.IsCancellationRequested)
{
IReadOnlyList<Domain.Entities.Trader> tradersToProcess = new List<Domain.Entities.Trader>();
try
{
IReadOnlyList<Domain.Entities.Trader> tradersToProcess = new List<Domain.Entities.Trader>();
Domain.Entities.BackgroundJob? activeJob = null;
using (var scope = _services.CreateScope())
@@ -260,7 +260,10 @@ public class TradeHistoryWorker : BackgroundService
}
catch (Exception ex) { _logger.LogError(ex, "TradeHistoryWorker error"); }
await Task.Delay(TimeSpan.FromMinutes(2), stoppingToken);
if (tradersToProcess == null || tradersToProcess.Count == 0)
{
await Task.Delay(TimeSpan.FromMinutes(2), stoppingToken);
}
}
_logger.LogInformation("📜 TradeHistoryWorker stopped");