auto license fetching now and generator more solid

This commit is contained in:
2020-06-15 19:26:29 +00:00
parent 69030bd767
commit 59f4c6a9d2
7 changed files with 38 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using AyaNova.Biz;
using AyaNova.Util;
namespace AyaNova.Generator
{
@@ -23,7 +24,11 @@ namespace AyaNova.Generator
private const int GENERATE_SECONDS = 5;
#else
private const int GENERATE_SECONDS = 20;
#endif
#endif
public GeneratorService(ILogger<GeneratorService> logger)
{
log = logger;
@@ -37,16 +42,16 @@ namespace AyaNova.Generator
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
//don't immediately run the generator stuff on boot
bool justStarted = true;
log.LogDebug($"GeneratorService is starting.");
stoppingToken.Register(() =>
log.LogDebug($" GeneratorService background task is stopping."));
while (!stoppingToken.IsCancellationRequested)
{
if (!justStarted)//give it a pause to settle on boot
if (!ServerGlobalOpsSettingsCache.BOOTING)
{
log.LogDebug($"GeneratorService running jobs");
@@ -62,7 +67,6 @@ namespace AyaNova.Generator
//=================================================================
}
await Task.Delay((GENERATE_SECONDS * 1000), stoppingToken);
justStarted = false;
}
log.LogDebug($"GeneratorService is stopping");
}