Suggest Totara Learn features

TL-35604 - Send notifications during the day rather than all at once at night

 
me
TL-35604 - Send notifications during the day rather than all at once at night
by George Angus - Sunday, 2 October 2022, 5:16 PM
Group Totara

Originally, CN implemented so that it would calculate the things to be sent at the time the information became available. E.g. when a seminar session is created, we scheduled the "3 days after session finishes" notification. We went away from that, because maintaining the queue is really difficult, with a very high chance of mistakes, and too many edge cases that needed handling. But a lot of the structure of how that happens (the queues) still remains.

Q: Would it be possible to calculate all the notifications that should be sent within the next 24 hours? 

We could put those notifications in the queue, then have a regular (e.g. every minute) task which checks that queue and sends the messages if they need to go out since the last time that rapidly-running task was run. This would have the advantage of only needing to run the large task once per day, as well as send notifications at exactly the time they should be sent.

There would be difficult things to work out. What happens if some change happens during that 24 hour period, such as a user's data changing so that the notif doesn't need to be sent, new notifications being created which should be triggered during that day, variability of when the daily cron task is run (if it's actually 26 hours since last run, and last run calculated 24 hours of notifs, what happens to the two hours of notifs that should have been sent in the last two hours?).