Yesterday my site started generating notifications for old posts out of the blue. This is the number of ‘posted’ notifications (notification_type = 9) created later than an hour in the past few days:
Query I used to generate the table
WITH pre AS ( SELECT p.id as post_id, to_char(n.created_at, 'YYYY-MM-DD') AS notified_day, p.topic_id, round(least(EXTRACT(EPOCH FROM n.created_at - p.created_at)::numeric, EXTRACT(EPOCH FROM n.created_at - p.updated_at)::numeric) / 3600) AS hours_diff, p.created_at, p.updated_at, n.created_at, u.username FROM notifications n LEFT JOIN posts p ON p.post_number = n.post_number AND p.topic_id = n.topic_id left join users u on u.id = n.user_id WHERE round(least(EXTRACT(EPOCH FROM n.created_at - p.created_at)::numeric, EXTRACT(EPOCH FROM n.created_at - p.updated_at)::numeric) / 3600) > 0 AND n.notification_type = 9 ORDER BY n.created_at DESC LIMIT 400 ) SELECT count(*), notified_day FROM pre GROUP BY notified_day ORDER BY notified_day DESC
Here are a few examples (from running the CTE in the query above):
The first highlighted row was created on December 8 but a user who is watching that category received a notification on December 25 (and from what other users have told me, they are being notified about posts they had already seen).
The second highlighted row was created on September 29, modified a day later and notified on December 25.
I just rebuilt the container so I’m running the latest version of Discourse. For now I’ve disabled email notifications.
Any ideas on how to troubleshoot this? I assume it’s either a queue that got backed up for some reason or something like that. Is there a way to find out what is generating these notifications?