From 2689e5885c713e0d33c696f299460e51423cd6e0 Mon Sep 17 00:00:00 2001
From: Tanner Prestegard <tanner.prestegard@ligo.org>
Date: Fri, 12 Apr 2019 14:08:11 -0500
Subject: [PATCH] Send phone alerts before email alerts

Email alerts seem to be more problematic due to AWS SES rate
limiting and phone alerts are more important, so we should send
phone alerts first.
---
 gracedb/alerts/main.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gracedb/alerts/main.py b/gracedb/alerts/main.py
index 6aef17ee2..e035799ca 100644
--- a/gracedb/alerts/main.py
+++ b/gracedb/alerts/main.py
@@ -69,12 +69,12 @@ def issue_alerts(event_or_superevent, alert_type, serialized_object,
     # Try to get label explicitly from kwargs
     label = kwargs.get('label', None)
 
-    # Issue email alerts
-    if settings.SEND_EMAIL_ALERTS and email_recipients.exists():
-        issue_email_alerts(event_or_superevent, alert_type, email_recipients,
-            label=label)
-
     # Issue phone alerts
     if settings.SEND_PHONE_ALERTS and phone_recipients.exists():
         issue_phone_alerts(event_or_superevent, alert_type, phone_recipients,
             label=label)
+
+    # Issue email alerts
+    if settings.SEND_EMAIL_ALERTS and email_recipients.exists():
+        issue_email_alerts(event_or_superevent, alert_type, email_recipients,
+            label=label)
-- 
GitLab