allow pending notifications to influence switchover.

Currently we switch if:

* status = delivered and updated_at - sent_at > threshold
* status = sending and now - sent_at > threshold

firetext can leave notifications in the pending state, which is
equivalent to sending in terms of how we should handle it, so this
commit changes the second case to allow pending as well as sending.
This commit is contained in:
Leo Hemsted
2019-02-21 15:57:24 +00:00
parent 19b285f5c7
commit a617ccca9d
3 changed files with 9 additions and 7 deletions

View File

@@ -484,7 +484,7 @@ def is_delivery_slow_for_provider(
).filter(
Notification.created_at >= created_at,
Notification.sent_at.isnot(None),
Notification.status.in_([NOTIFICATION_DELIVERED, NOTIFICATION_SENDING]),
Notification.status.in_([NOTIFICATION_DELIVERED, NOTIFICATION_PENDING, NOTIFICATION_SENDING]),
Notification.sent_by == provider,
Notification.key_type != KEY_TYPE_TEST
).group_by("slow").all()