Add error handling for failed emails

Created on 22 July 2020, almost 4 years ago
Updated 5 February 2023, over 1 year ago

There are three types of emails sent from this module:

  • Announcements - processed and sent as swiftly as possible per cron run
  • Immediate Group Subscriptions - processed and sent as swiftly as possible per cron run
  • Daily Group Subscriptions - processed and sent after a certain hour (set in config) per cron run

Currently all three of these types of messages attempt to send an email and just assume it succeeds. After attempting to send the email the module blindly removes the email item from the queue and moves to the next item. We should add a check to see if the message actually sends and if not release the item back into the queue.

For announcements and immediate subscriptions this is fairly simple. The item just goes back in the queue to be processed later. But for daily subscriptions things are a bit more complicated. Currently the way we determine when daily subs are done processing is if the queue is empty. If we release items back into the queue for failed sends and they continue to fail then we could get into a situation where the daily queue never completes.

We likely need to set a (configurable?) time limit for how long the module should work on processing daily subs, after which it considers the task done even if items are still left in the queue - OR - we could add a new table for the module where failed messages are saved. Then moving forward, any time a failure occurs we check that table and increment the fail counter for that user. If the failure count reaches a threshold (configurable?) we remove the item from the queue and stop trying to send. We could also check this table when building subs and stop building subs for folks with a failure count over the threshold.

If we went this route we would likely need to add a new admin page to the module where admins can see a list of users who have currently gone over the threshold. Otherwise it will be potentially confusing for admins as to why some users aren't getting messages anymore. Alternatively we could display a notification on the user's profile saying that the threshold was reached.

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada JayDarnell Guelph, Ontario

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024