mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Add new task to alert about created email / sms
This will log an error when email or SMS notifications have been stuck in 'created' for too long - normally they should be 'sending' in seconds, noting that we have a goal of < 10s wait time for most notifications being processed our platform. In the next commits we'll decouple similar functionality from the existing 'timeout-sending-notifications' task.
This commit is contained in:
@@ -512,6 +512,16 @@ def _timeout_notifications(current_statuses, new_status, timeout_start, updated_
|
||||
return notifications
|
||||
|
||||
|
||||
def dao_check_notifications_still_in_created(minimum_age_in_seconds):
|
||||
min_created_at = datetime.utcnow() - timedelta(seconds=minimum_age_in_seconds)
|
||||
|
||||
return Notification.query.filter(
|
||||
Notification.created_at < min_created_at,
|
||||
Notification.status == NOTIFICATION_CREATED,
|
||||
Notification.notification_type.in_([SMS_TYPE, EMAIL_TYPE])
|
||||
).count()
|
||||
|
||||
|
||||
def dao_timeout_notifications(timeout_period_in_seconds):
|
||||
"""
|
||||
Timeout SMS and email notifications by the following rules:
|
||||
|
||||
Reference in New Issue
Block a user