This commit is contained in:
2020-08-06 17:07:21 +00:00
parent 4d818a2ccf
commit 6d1d753433
5 changed files with 25 additions and 5 deletions

View File

@@ -66,6 +66,8 @@ namespace AyaNova.Biz
{
using (AyContext ct = ServiceProviderProvider.DBContext)
{
log.LogDebug($"Adding new job:{newJob.ToString()}");
await LogJobAsync(newJob.GId, $"Adding new job \"{newJob.Name}\" to queue");
await ct.OpsJob.AddAsync(newJob);
await ct.SaveChangesAsync();
}
@@ -83,6 +85,7 @@ namespace AyaNova.Biz
{
try
{
log.LogDebug($"RemoveJobAndLogs for job id:{jobIdToBeDeleted}");
//delete logs
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from aopsjoblog where jobid = {jobIdToBeDeleted}");
//delete the job
@@ -169,6 +172,7 @@ namespace AyaNova.Biz
ActivelyProcessing = true;
try
{
log.LogDebug("Processing critical internal jobs");
//### Critical internal jobs, these run even if there is a license related serverlock
//LICENSE FETCH
await CoreJobLicense.DoWorkAsync();
@@ -193,6 +197,7 @@ namespace AyaNova.Biz
// return;
// }
log.LogDebug("Processing semi-critical internal jobs");
//BACKUP
await CoreJobBackup.DoWorkAsync();
@@ -204,8 +209,9 @@ namespace AyaNova.Biz
//JOB SWEEPER / AND USER COUNT CHECK
await CoreJobSweeper.DoWorkAsync();
//### API Open only jobs
if (!serverState.IsOpen) return;
log.LogDebug("Processing exclusive dynamic jobs");
//BIZOBJECT DYNAMIC JOBS
//get a list of exclusive jobs that are due to happen
@@ -226,10 +232,17 @@ namespace AyaNova.Biz
}
}
//### API Open only jobs
if (!serverState.IsOpen)
{
log.LogDebug("Server state is NOT open, skipping processing non-exclusive dynamic jobs");
return;
}
///////////////////////////////////////
//NON-EXCLUSIVE JOBS
//
log.LogDebug("Processing non-exclusive dynamic jobs");
//These fire and forget but use a technique to bubble up exceptions anyway
List<OpsJob> sharedJobs = await GetReadyJobsNotExlusiveOnlyAsync();