Decreased Job timer from 20 seconds to 1 second as it was delaying report generation unnecessarily

This commit is contained in:
2022-01-04 20:42:45 +00:00
parent 8bb7f638aa
commit 29e5445350
2 changed files with 15 additions and 10 deletions

View File

@@ -182,7 +182,7 @@ namespace AyaNova.Biz
if (ActivelyProcessing)
{
//System.Diagnostics.Debug.WriteLine("ProcessJobs called but actively processing other jobs so returning");
log.LogTrace("ProcessJobs called but actively processing other jobs so returning");
//log.LogTrace("ProcessJobs called but actively processing other jobs so returning");
return;
}
if (!KeepOnWorking()) return;

View File

@@ -20,11 +20,11 @@ namespace AyaNova.Generator
{
private readonly ILogger<GeneratorService> log;
// private const int MAXIMUM_MS_ALLOWED_FOR_PROCESSING_ALL_JOBS = 1 * 60 * 1000;//1 minutes TEST TEST TEST #####
#if (DEBUG)
private const int GENERATE_SECONDS = 5;
#else
private const int GENERATE_SECONDS = 20;
#endif
// #if (DEBUG)
// private const int GENERATE_SECONDS = 1;
// #else
// private const int GENERATE_SECONDS = 20;
// #endif
@@ -38,7 +38,7 @@ namespace AyaNova.Generator
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
log.LogDebug($"GeneratorService is starting.");
log.LogInformation($"GeneratorService is starting.");
stoppingToken.Register(() =>
log.LogDebug($" GeneratorService background task is stopping."));
@@ -48,7 +48,7 @@ namespace AyaNova.Generator
{
if (!ServerGlobalOpsSettingsCache.BOOTING)
{
log.LogDebug($"GeneratorService running jobs");
// log.LogTrace($"GeneratorService running jobs");
//=================================================================
try
@@ -61,9 +61,14 @@ namespace AyaNova.Generator
}
//=================================================================
}
await Task.Delay((GENERATE_SECONDS * 1000), stoppingToken);
//There *MUST* be a delay here or the server will come to a standstill
//ideally need to move on from this method of generation to something external or more reasonable but
//this does work, we need to get to release, for our projected use load this should be fine and it's
//a documented by MS method to do asp.net core job processing
//https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-6.0&tabs=visual-studio
await Task.Delay(1000);
}
log.LogDebug($"GeneratorService is stopping");
log.LogInformation($"GeneratorService is stopping");
}
public override Task StopAsync(CancellationToken stoppingToken)