From ce663cc36bd66842b9e65a0cccb3e902e4fefab9 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 3 Aug 2021 00:47:46 +0000 Subject: [PATCH] --- server/AyaNova/biz/PMBiz.cs | 10 ++++++++-- server/AyaNova/generator/CoreNotificationSweeper.cs | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/server/AyaNova/biz/PMBiz.cs b/server/AyaNova/biz/PMBiz.cs index 2308e4fc..d788f5a3 100644 --- a/server/AyaNova/biz/PMBiz.cs +++ b/server/AyaNova/biz/PMBiz.cs @@ -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 diff --git a/server/AyaNova/generator/CoreNotificationSweeper.cs b/server/AyaNova/generator/CoreNotificationSweeper.cs index c9966079..f5054376 100644 --- a/server/AyaNova/generator/CoreNotificationSweeper.cs +++ b/server/AyaNova/generator/CoreNotificationSweeper.cs @@ -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}"); }