fix(notifications): dead notifications that are still present long after (#1186)

This commit is contained in:
Stan Girard 2023-09-16 16:09:38 +02:00 committed by GitHub
parent 86c10bd14d
commit f847ee84a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -1,3 +1,4 @@
from datetime import datetime, timedelta
from typing import Optional from typing import Optional
from uuid import UUID from uuid import UUID
@ -115,10 +116,13 @@ class Notifications(Repository):
Returns: Returns:
list[Notification]: The notifications list[Notification]: The notifications
""" """
five_minutes_ago = datetime.now() - timedelta(minutes=5)
notifications = ( notifications = (
self.db.from_("notifications") self.db.from_("notifications")
.select("*") .select("*")
.filter("chat_id", "eq", chat_id) .filter("chat_id", "eq", chat_id)
.filter("datetime", "lt", five_minutes_ago)
.execute() .execute()
).data ).data