Fix styling, job endpoints, and infinite worker loops
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user