Maintenance will be performed on git.ligo.org, chat.ligo.org, containers.ligo.org, and docs.ligo.org starting at around 10am CST on Tuesday 28 January 2020. It is expected to take around an hour and there will be a short period, around five minutes, of downtime towards the end of the maintenance window. In addition the GitLab-CI runners will be paused starting at around 9am CST in order to be updated.

Commit 2906f1d7 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB

Change mechanism for sending emails

Instead of looping over EmailMessage.send() calls, we now get the
email backend and send a list of messages. Note that the backend
sends the messages individually still but this cuts out some of the
overhead.
parent d7ab65db
......@@ -603,7 +603,7 @@ LOGGING = {
'propagate': True,
'level': LOG_LEVEL,
},
'django.request': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': False,
......
......@@ -3,7 +3,7 @@ import logging
import textwrap
from django.conf import settings
from django.core.mail import EmailMessage
from django.core.mail import EmailMessage, get_connection
from django.urls import reverse
from core.time_utils import gpsToUtc
......@@ -143,10 +143,13 @@ def issue_email_alerts(event_or_superevent, alert_type, recipients,
logger.debug("Sending email to {recips}".format(
recips=", ".join([r.email for r in recipients])))
# Send mail individually so all emails are not rejected due to a single
# address being blacklisted
# Construct email messages
messages = []
for recip in recipients:
# Send email
email = EmailMessage(subject=subject, body=email_body,
from_email=settings.ALERT_EMAIL_FROM, to=[recip.email])
email.send()
messages.append(email)
# Send email messages
backend = get_connection()
backend.send_messages(messages)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment