This commit is contained in:
2020-05-25 22:37:12 +00:00
parent 486e7db27c
commit 41514ea408

View File

@@ -4,7 +4,6 @@ using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using AyaNova.Models; using AyaNova.Models;
using System.Threading;
namespace AyaNova.Biz namespace AyaNova.Biz
{ {
@@ -30,8 +29,6 @@ namespace AyaNova.Biz
// //
public static async Task DoSweepAsync() public static async Task DoSweepAsync()
{ {
//This will get triggered roughly every minute, but we don't want to sweep that frequently //This will get triggered roughly every minute, but we don't want to sweep that frequently
if (DateTime.UtcNow - lastSweep < SWEEP_EVERY_INTERVAL) if (DateTime.UtcNow - lastSweep < SWEEP_EVERY_INTERVAL)
return; return;
@@ -45,14 +42,11 @@ namespace AyaNova.Biz
DateTime dtDeleteCutoff = DateTime.UtcNow - SUCCEEDED_JOBS_DELETE_AFTER_THIS_TIMESPAN; DateTime dtDeleteCutoff = DateTime.UtcNow - SUCCEEDED_JOBS_DELETE_AFTER_THIS_TIMESPAN;
await sweepAsync(ct, dtDeleteCutoff, JobStatus.Completed); await sweepAsync(ct, dtDeleteCutoff, JobStatus.Completed);
//SWEEP FAILED JOBS //SWEEP FAILED JOBS
//calculate cutoff to delete //calculate cutoff to delete
dtDeleteCutoff = DateTime.UtcNow - FAILED_JOBS_DELETE_AFTER_THIS_TIMESPAN; dtDeleteCutoff = DateTime.UtcNow - FAILED_JOBS_DELETE_AFTER_THIS_TIMESPAN;
await sweepAsync(ct, dtDeleteCutoff, JobStatus.Failed); await sweepAsync(ct, dtDeleteCutoff, JobStatus.Failed);
//KILL STUCK JOBS //KILL STUCK JOBS
//calculate cutoff to delete //calculate cutoff to delete
DateTime dtRunningDeadline = DateTime.UtcNow - RUNNING_JOBS_BECOME_FAILED_AFTER_THIS_TIMESPAN; DateTime dtRunningDeadline = DateTime.UtcNow - RUNNING_JOBS_BECOME_FAILED_AFTER_THIS_TIMESPAN;