# Meldingen worden onjuist aangemaakt voor oude berichten

**URL:** <https://meta.discourse.org/t/notifications-being-incorrectly-created-for-old-posts/174247>\
**Category:** Product Support\
**Created:** [25 december 2020 om 08:27 UTC](https://meta.discourse.org/t/notifications-being-incorrectly-created-for-old-posts/174247 "2020-12-25T08:27:46Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)\
**Post date:** [25 december 2020 om 08:27 UTC](https://meta.discourse.org/t/notifications-being-incorrectly-created-for-old-posts/174247/1 "2020-12-25T08:27:46Z")

</div>

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:

 ![image](https://global.discourse-cdn.com/meta/original/3X/d/6/d60767bd9dff44a62ec9af7c48c9f83a1c85ed76.png)

> **Query I used to generate the table**
>
> ```sql
> 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):

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/3/c32d46872a0c0fdac1d9683c547f9349d0517136.png)

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?

---

_[View the full topic](https://meta.discourse.org/t/notifications-being-incorrectly-created-for-old-posts/174247)._
