This commit is contained in:
@@ -254,8 +254,6 @@ namespace AyaNova.Biz
|
||||
ActivelyProcessing = true;
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
//Sweep jobs table
|
||||
System.Diagnostics.Debug.WriteLine($"JobsBiz processing sweeper");
|
||||
await CoreJobSweeper.DoSweepAsync();//run exclusively
|
||||
@@ -270,6 +268,8 @@ namespace AyaNova.Biz
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"JobsBiz processing exclusive biz job {j.Name}");
|
||||
await ProcessJobAsync(j);
|
||||
//Capture metrics
|
||||
CoreJobMetricsSnapshot.DoJob();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -296,34 +296,22 @@ namespace AyaNova.Biz
|
||||
System.Diagnostics.Debug.WriteLine($"JobsBiz processing backup");
|
||||
await CoreJobBackup.DoWorkAsync();//sb exclusive
|
||||
System.Diagnostics.Debug.WriteLine($"JobsBiz processing metrics snapshotter");
|
||||
|
||||
|
||||
//Capture metrics
|
||||
CoreJobMetricsSnapshot.DoJob();
|
||||
|
||||
///////////////////////////////////////
|
||||
//NON-EXCLUSIVE JOBS
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
//LOOKAT: Parallelize / background this block
|
||||
//http://www.dotnetcurry.com/dotnet/1360/concurrent-programming-dotnet-core
|
||||
|
||||
//var backgroundTask = Task.Run(() => DoComplexCalculation(42));
|
||||
//also have to deal with db object etc, I guess they'd have to instantiate themselves to avoid disposed object being used error
|
||||
//This area may turn out to need a re-write in future, but I think it might only involve this block and ProcessJobAsync
|
||||
//the actual individual objects that are responsible for jobs will likely not need a signature rewrite or anything (I hope)
|
||||
//For now I'z hoping that no job will be so slow that it can hold up all the other jobs indefinitely.
|
||||
|
||||
//These fire and forget but use a technique to bubble up exceptions anyway
|
||||
List<OpsJob> sharedJobs = await GetReadyJobsNotExlusiveOnlyAsync();
|
||||
foreach (OpsJob j in sharedJobs)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
System.Diagnostics.Debug.WriteLine($"JobsBiz processing NON-exclusive biz job {j.Name}");
|
||||
// Task.Run(() => FireAway());
|
||||
TaskUtil.Forget(Task.Run(() => ProcessJobAsync(j)));
|
||||
// await ProcessJobAsync(j, ct);
|
||||
System.Diagnostics.Debug.WriteLine($"JobsBiz processing NON-exclusive biz job {j.Name}");
|
||||
TaskUtil.Forget(Task.Run(() => ProcessJobAsync(j)));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace AyaNova.Generator
|
||||
public class GeneratorService : BackgroundService
|
||||
{
|
||||
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 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;
|
||||
@@ -64,8 +64,9 @@ namespace AyaNova.Generator
|
||||
System.Diagnostics.Debug.WriteLine($"### GENERATE calling JobsBiz.ProcessJobs");
|
||||
//Capture metrics
|
||||
CoreJobMetricsSnapshot.DoJob();
|
||||
//TODO: this should be big timeout and then inside the process jobs each job has it's own timeout
|
||||
await JobsBiz.ProcessJobsAsync();
|
||||
await JobsBiz.ProcessJobsAsync();
|
||||
//Capture metrics again, (calling repeatedly won't increase metrics but will ensure it doesn't miss frequency of capturing)
|
||||
CoreJobMetricsSnapshot.DoJob();
|
||||
System.Diagnostics.Debug.WriteLine($"### GENERATE BACK FROM calling JobsBiz.ProcessJobs");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user