This commit is contained in:
@@ -4753,8 +4753,14 @@ namespace AyaNova.Biz
|
||||
//
|
||||
internal static async Task ProcessInsufficientInventoryNotificationAsync(AyContext ct, ILogger log)
|
||||
{
|
||||
//quick check if *anyone* is subscribed to this and early exit if not
|
||||
//still here? Then get a list of all upcoming PM's by id and date
|
||||
//TODO: how to know when to stop, won't this just keep repeating??
|
||||
//check log? Has it's own frequency unlike 12 hour thing??
|
||||
//ideally sb once only, perhaps once only every 90 days or however long the log is kept for
|
||||
//quick check if *anyone* is subscribed to this early exit if not
|
||||
//still here, check list again to see if it's been notified for that subscription id and remove it if yes
|
||||
//some kind of collection + query magic here?
|
||||
|
||||
//still here? subscriber List not empty? Then get a list of all upcoming PM's by id and date
|
||||
//iterate PM's
|
||||
//each PM
|
||||
//iterate list of subscribers and see if any pm's are within the threshold
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
private static ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("CoreNotificationSweeper");
|
||||
private static DateTime lastSweep = DateTime.MinValue;
|
||||
private static TimeSpan DELETE_AFTER_AGE = new TimeSpan(90, 0, 0, 0);
|
||||
private static TimeSpan DELETE_AFTER_AGE = new TimeSpan(90, 0, 0, 0);//## WARNING CoreJobPMInventoryCheck EXPECTS THIS TO BE a pretty big value 90 days right now
|
||||
private static TimeSpan SWEEP_EVERY_INTERVAL = new TimeSpan(8, 0, 0);//once every 8 hours, three times a day
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -42,6 +42,7 @@ namespace AyaNova.Biz
|
||||
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from anotifyevent where eventdate < {dtPastEventCutoff} and created < {dtDeleteCutoff}");
|
||||
|
||||
//NotifyDeliveryLog - deletes all log items older than 90 days (NOTE: this log is also used to identify and prevent high frequency repetitive dupes)
|
||||
//Note: also has bearing on CoreJobPMInventoryCheck which uses notifydeliverylog to check if pm inventory notify has been done it's one time already
|
||||
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from anotifydeliverylog where processed < {dtDeleteCutoff}");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user