This commit is contained in:
@@ -254,8 +254,6 @@ namespace AyaNova.Biz
|
|||||||
ActivelyProcessing = true;
|
ActivelyProcessing = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//Sweep jobs table
|
//Sweep jobs table
|
||||||
System.Diagnostics.Debug.WriteLine($"JobsBiz processing sweeper");
|
System.Diagnostics.Debug.WriteLine($"JobsBiz processing sweeper");
|
||||||
await CoreJobSweeper.DoSweepAsync();//run exclusively
|
await CoreJobSweeper.DoSweepAsync();//run exclusively
|
||||||
@@ -270,6 +268,8 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
System.Diagnostics.Debug.WriteLine($"JobsBiz processing exclusive biz job {j.Name}");
|
System.Diagnostics.Debug.WriteLine($"JobsBiz processing exclusive biz job {j.Name}");
|
||||||
await ProcessJobAsync(j);
|
await ProcessJobAsync(j);
|
||||||
|
//Capture metrics
|
||||||
|
CoreJobMetricsSnapshot.DoJob();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -297,33 +297,21 @@ namespace AyaNova.Biz
|
|||||||
await CoreJobBackup.DoWorkAsync();//sb exclusive
|
await CoreJobBackup.DoWorkAsync();//sb exclusive
|
||||||
System.Diagnostics.Debug.WriteLine($"JobsBiz processing metrics snapshotter");
|
System.Diagnostics.Debug.WriteLine($"JobsBiz processing metrics snapshotter");
|
||||||
|
|
||||||
|
//Capture metrics
|
||||||
|
CoreJobMetricsSnapshot.DoJob();
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
//NON-EXCLUSIVE JOBS
|
//NON-EXCLUSIVE JOBS
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//These fire and forget but use a technique to bubble up exceptions anyway
|
||||||
|
|
||||||
|
|
||||||
//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.
|
|
||||||
|
|
||||||
List<OpsJob> sharedJobs = await GetReadyJobsNotExlusiveOnlyAsync();
|
List<OpsJob> sharedJobs = await GetReadyJobsNotExlusiveOnlyAsync();
|
||||||
foreach (OpsJob j in sharedJobs)
|
foreach (OpsJob j in sharedJobs)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
System.Diagnostics.Debug.WriteLine($"JobsBiz processing NON-exclusive biz job {j.Name}");
|
System.Diagnostics.Debug.WriteLine($"JobsBiz processing NON-exclusive biz job {j.Name}");
|
||||||
// Task.Run(() => FireAway());
|
|
||||||
TaskUtil.Forget(Task.Run(() => ProcessJobAsync(j)));
|
TaskUtil.Forget(Task.Run(() => ProcessJobAsync(j)));
|
||||||
// await ProcessJobAsync(j, ct);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace AyaNova.Generator
|
|||||||
public class GeneratorService : BackgroundService
|
public class GeneratorService : BackgroundService
|
||||||
{
|
{
|
||||||
private readonly ILogger<GeneratorService> log;
|
private readonly ILogger<GeneratorService> log;
|
||||||
// private const int MAXIMUM_MS_ALLOWED_FOR_PROCESSING_ALL_JOBS = 1 * 60 * 1000;//1 minutes TEST TEST TEST #####
|
// private const int MAXIMUM_MS_ALLOWED_FOR_PROCESSING_ALL_JOBS = 1 * 60 * 1000;//1 minutes TEST TEST TEST #####
|
||||||
#if(DEBUG)
|
#if (DEBUG)
|
||||||
private const int GENERATE_SECONDS = 5;
|
private const int GENERATE_SECONDS = 5;
|
||||||
#else
|
#else
|
||||||
private const int GENERATE_SECONDS = 20;
|
private const int GENERATE_SECONDS = 20;
|
||||||
@@ -64,8 +64,9 @@ namespace AyaNova.Generator
|
|||||||
System.Diagnostics.Debug.WriteLine($"### GENERATE calling JobsBiz.ProcessJobs");
|
System.Diagnostics.Debug.WriteLine($"### GENERATE calling JobsBiz.ProcessJobs");
|
||||||
//Capture metrics
|
//Capture metrics
|
||||||
CoreJobMetricsSnapshot.DoJob();
|
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");
|
System.Diagnostics.Debug.WriteLine($"### GENERATE BACK FROM calling JobsBiz.ProcessJobs");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user