This commit is contained in:
@@ -49,7 +49,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
case NotifyEventType.BackupStatus:
|
||||
case NotifyEventType.DefaultNotification:
|
||||
case NotifyEventType.NotifyHealthCheck:
|
||||
case NotifyEventType.NotifyHealthCheck://created by job processor itself
|
||||
case NotifyEventType.ServerOperationsProblem:
|
||||
break;
|
||||
default://this will likely be a development error, not a production error so no need to log etc
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace AyaNova.Biz
|
||||
OutsideServiceOverdue = 16,//Workorder object , WorkorderItemOutsideService created / updated, sets advance notice on due date tag filterable
|
||||
OutsideServiceReceived = 17,//Workorder object , WorkorderItemOutsideService updated, instant notification when item received, tag filterable
|
||||
PartRequestReceived = 18,//Workorder object / workorderitempartrequest updated, sent to person who requested when parts received back
|
||||
NotifyHealthCheck = 19,//NO OBJECT, direct subscription to receive recurring daily notify system "ping" sent out at fixed time of 9am every day server local time
|
||||
NotifyHealthCheck = 19,//NO OBJECT, direct subscription to receive recurring daily notify system "ping" sent out between 8am and 10am once every 24 hours minimum every day server local time
|
||||
BackupStatus = 20,//NO OBJECT, direct subscription to receive results of last backup operation
|
||||
CustomerServiceImminent = 21,//Workorder / WorkorderItemScheduledUser object, notice that scheduled service is due, can set advance notice, CUSTOMER gets delivery
|
||||
PartRequested = 22,//Workorder object / workorderitempartrequest created tag filterable
|
||||
|
||||
@@ -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