case 4192
This commit is contained in:
@@ -343,7 +343,7 @@ namespace AyaNova.Biz
|
||||
var batchResults = await ct.TaxCode.AsNoTracking().Where(z => batch.Contains(z.Id)).ToArrayAsync();
|
||||
//order the results back into original
|
||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||
batchResults=null;
|
||||
batchResults = null;
|
||||
foreach (TaxCode w in orderedList)
|
||||
{
|
||||
if (!ReportRenderManager.KeepGoing(jobId)) return null;
|
||||
@@ -352,7 +352,7 @@ namespace AyaNova.Biz
|
||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||
ReportData.Add(jo);
|
||||
}
|
||||
orderedList=null;
|
||||
orderedList = null;
|
||||
}
|
||||
return ReportData;
|
||||
}
|
||||
@@ -434,10 +434,30 @@ namespace AyaNova.Biz
|
||||
else
|
||||
idList = await ct.TaxCode.AsNoTracking().Select(z => z.Id).ToListAsync();
|
||||
bool SaveIt = false;
|
||||
|
||||
//---------------------------------
|
||||
//case 4192
|
||||
TimeSpan ProgressAndCancelCheckSpan = new TimeSpan(0, 0, ServerBootConfig.JOB_PROGRESS_UPDATE_AND_CANCEL_CHECK_SECONDS);
|
||||
DateTime LastProgressCheck = DateTime.UtcNow.Subtract(new TimeSpan(1, 1, 1, 1, 1));
|
||||
var TotalRecords = idList.LongCount();
|
||||
long CurrentRecord = -1;
|
||||
//---------------------------------
|
||||
foreach (long id in idList)
|
||||
{
|
||||
try
|
||||
{
|
||||
//--------------------------------
|
||||
//case 4192
|
||||
//Update progress / cancel requested?
|
||||
CurrentRecord++;
|
||||
if (DateUtil.IsAfterDuration(LastProgressCheck, ProgressAndCancelCheckSpan))
|
||||
{
|
||||
await JobsBiz.UpdateJobProgressAsync(job.GId, $"{CurrentRecord}/{TotalRecords}");
|
||||
if (await JobsBiz.GetJobStatusAsync(job.GId) == JobStatus.CancelRequested)
|
||||
break;
|
||||
LastProgressCheck = DateTime.UtcNow;
|
||||
}
|
||||
//---------------------------------
|
||||
SaveIt = false;
|
||||
ClearErrors();
|
||||
TaxCode o = null;
|
||||
@@ -473,7 +493,7 @@ namespace AyaNova.Biz
|
||||
FailedObjectCount++;
|
||||
}
|
||||
}
|
||||
//TEMPORARY MEASURE AWAITING BETTER SOLUTION AND CANCELLABLE EXTENSION JOBS
|
||||
|
||||
//delay so we're not tying up all the resources in a tight loop
|
||||
await Task.Delay(AyaNova.Util.ServerBootConfig.JOB_OBJECT_HANDLE_BATCH_JOB_LOOP_DELAY);
|
||||
}
|
||||
@@ -483,6 +503,11 @@ namespace AyaNova.Biz
|
||||
await JobsBiz.LogJobAsync(job.GId, ExceptionUtil.ExtractAllExceptionMessages(ex));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------
|
||||
//case 4192
|
||||
await JobsBiz.UpdateJobProgressAsync(job.GId, $"{++CurrentRecord}/{TotalRecords}");
|
||||
//---------------------------------
|
||||
await JobsBiz.LogJobAsync(job.GId, $"LT:BatchJob {job.SubType} {idList.Count}{(FailedObjectCount > 0 ? " - LT:Failed " + FailedObjectCount : "")}");
|
||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed);
|
||||
}
|
||||
@@ -498,7 +523,7 @@ namespace AyaNova.Biz
|
||||
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<TaxCodeBiz>();
|
||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
|
||||
Reference in New Issue
Block a user