This commit is contained in:
@@ -18,6 +18,9 @@ namespace AyaNova.Biz
|
||||
private static DateTime lastRun = DateTime.MinValue;
|
||||
private static TimeSpan DELETE_AFTER_AGE = new TimeSpan(90, 0, 0, 0);
|
||||
private static TimeSpan RUN_EVERY_INTERVAL = new TimeSpan(0, 2, 0);//once every 2 minutes minimum
|
||||
private static DateTime lastNotifyHealthCheckSentLocal = DateTime.MinValue;
|
||||
private static TimeSpan TS_24_HOURS = new TimeSpan(24, 0, 0);//used to ensure daily ops happen no more than that
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DoSweep
|
||||
@@ -41,6 +44,23 @@ namespace AyaNova.Biz
|
||||
NotifyIsRunning = true;
|
||||
log.LogTrace("Notify set to RUNNING state and starting now");
|
||||
|
||||
//NotifyHealthCheck processing
|
||||
//Note this deliberately uses LOCAL time in effort to deliver the health check first thing in the morning for workers
|
||||
//However if server is on UTC already then that's what is used, there is no adjustment
|
||||
DateTime dtNowLocal = DateTime.Now;
|
||||
if (dtNowLocal - lastNotifyHealthCheckSentLocal > TS_24_HOURS)
|
||||
{
|
||||
//are we in the 7th to 9th hour?
|
||||
if (dtNowLocal.Hour > 6 && dtNowLocal.Hour < 10)
|
||||
{
|
||||
log.LogTrace("Notify health check submitted to subscribers");
|
||||
await NotifyEventProcessor.AddGeneralNotifyEvent(NotifyEventType.NotifyHealthCheck, "OK");
|
||||
lastNotifyHealthCheckSentLocal = dtNowLocal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
using (AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user