Skip to content

Commit 8ae7aa7

Browse files
committed
[mock_uss] Cleanup rid notificExtractTemplateScopeFieldsFromFlightPlanations
1 parent dade5df commit 8ae7aa7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

monitoring/mock_uss/ridsp/user_notifications.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
from . import database
1919

20+
NOTIFICATIONS_LIMIT = datetime.timedelta(hours=1)
21+
2022

2123
class ServiceProviderUserNotifications(ImplicitDict):
2224
user_notifications: list[UserNotification] = []
@@ -46,6 +48,15 @@ def create_notifications_if_needed(self, record: "database.TestRecord"):
4648
):
4749
self.record_notification(message=notif_str, observed_at=notif_date)
4850

51+
self.cleanup()
52+
53+
def cleanup(self):
54+
self.user_notifications = [
55+
notif
56+
for notif in self.user_notifications
57+
if notif.observed_at + NOTIFICATIONS_LIMIT > arrow.utcnow().datetime
58+
]
59+
4960

5061
def check_and_generate_missing_fields_notifications(
5162
injected_flights: list[TestFlight],

0 commit comments

Comments
 (0)