auto license fetching now and generator more solid
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user