This commit is contained in:
2019-10-23 23:15:41 +00:00
parent 925025c36e
commit c76c94051e
2 changed files with 14 additions and 15 deletions

View File

@@ -68,7 +68,7 @@ namespace AyaNova.Generator
while (!stoppingToken.IsCancellationRequested)
{
if (!justStarted)
{
log.LogDebug($"GeneratorService task doing background work.");
@@ -78,21 +78,24 @@ namespace AyaNova.Generator
AyContext ct = scope.ServiceProvider.GetRequiredService<AyContext>();
ApiServerState serverState = scope.ServiceProvider.GetRequiredService<ApiServerState>();
if (!serverState.IsOpen)
{
log.LogDebug($"GeneratorService: ServerState is closed returning without processing jobs, will try again next iteration");
return;
}
//=================================================================
try
{
await JobsBiz.ProcessJobsAsync(ct, serverState);
if (!serverState.IsOpen)
{
log.LogDebug($"GeneratorService: ServerState is closed returning without processing jobs, will try again next iteration");
}
else
{
await JobsBiz.ProcessJobsAsync(ct, serverState);
}
}
catch (Exception ex)
{
log.LogError(ex,"Generate::ProcessJobs result in exception error ");
log.LogError(ex, "Generate::ProcessJobs result in exception error ");
}
//=================================================================
}