Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
notifier
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
notifier
Commits
ead2628a
Commit
ead2628a
authored
May 16, 2016
by
sanfordstudent
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #37 from edx/sstudent/TNL-4368
Adding call to Dead Man's Snitch
parents
42c9cd09
91005eb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
notifier/settings.py
+3
-0
notifier/tasks.py
+6
-3
No files found.
notifier/settings.py
View file @
ead2628a
...
...
@@ -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
notifier/tasks.py
View file @
ead2628a
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment