Commit ead2628a by sanfordstudent

Merge pull request #37 from edx/sstudent/TNL-4368

Adding call to Dead Man's Snitch
parents 42c9cd09 91005eb2
......@@ -202,3 +202,5 @@ LOCALE_PATHS = (os.path.join(os.path.dirname(os.path.dirname(__file__)), 'locale
# Parameterize digest logo image url
LOGO_IMAGE_URL = os.getenv('LOGO_IMAGE_URL', "{}/static/images/edx-theme/edx-header-logo.png".format(LMS_URL_BASE))
DEAD_MANS_SNITCH_URL = os.getenv('DEAD_MANS_SNITCH_URL', '')
\ No newline at end of file
......@@ -4,6 +4,7 @@ Celery tasks for generating and sending digest emails.
from contextlib import closing
from datetime import datetime, timedelta
import logging
import requests
from boto.ses.exceptions import SESMaxSendingRateExceededError
import celery
......@@ -48,9 +49,10 @@ def generate_and_send_digests(users, from_dt, to_dt):
)
msg.attach_alternative(html, "text/html")
msgs.append(msg)
if not msgs:
return
cx.send_messages(msgs)
if msgs:
cx.send_messages(msgs)
if settings.DEAD_MANS_SNITCH_URL:
requests.post(settings.DEAD_MANS_SNITCH_URL)
except (CommentsServiceException, SESMaxSendingRateExceededError) as e:
# only retry if no messages were successfully sent yet.
if not any((getattr(msg, 'extra_headers', {}).get('status') == 200 for msg in msgs)):
......@@ -59,6 +61,7 @@ def generate_and_send_digests(users, from_dt, to_dt):
# raise right away, since we don't support partial retry
raise
def _time_slice(minutes, now=None):
"""
Returns the most recently-elapsed time slice of the specified length (in
......
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