Email notifications get skipped on busy topics

This has already popped up twice:

https://meta.discourse.org/t/missing-notification-emails-on-busy-topics/13380

and

I just reprod it locally and am working on fix but I wanted to explain what is going on:

To repro:

  1. On account A watch a topic
  2. On account B reply to topic twice.

What happens:

  1. We generate a notification for A saying that a topic got a reply
  2. We delete notification (1)
  3. We create a new notification that rolls up (1)

This rollup behavior messes up the email notifier, it tries looking up notification (1) but it is no longer in the table, so that notification is skipped.

This leads to 2 very bad side-effects

  1. Email notification can be delayed way beyond the default window (10 minutes) … repro is quite simple, post a reply in watched a topic every 9 minutes and you will not trigger notifications ever.

  2. Email is “rolled up” unintentionally. Previous replies becomes a “critical” piece of information otherwise you lose reply notifications on active topics.

The fix though is fairly complicated, so I just wanted to log this here to explain what it is I am fixing.

8 Likes

Thank you @sam I’ve seen this too, but didn’t know enough about what other users were doing to create such a detailed report.

So the repro is for the same person to post twice in the same topic? Seems a bit edge-casey if so.

No … any 2 people, when you see

“:arrow_backward: N replies” in your notifications this condition is hit. Can be any 2 different people.

Examples of this condition are here:

3 Likes

Fixed per:

https://github.com/discourse/discourse/commit/1bb485fca50c7c235ea307f5b51bb0366f80317b

3 Likes