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
55868fd7
Commit
55868fd7
authored
May 11, 2016
by
Sanford Student
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding calling to dms upon completion of digest task
parent
4680e02d
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 @
55868fd7
...
...
@@ -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'
,
'notifications@example.org'
)
\ No newline at end of file
notifier/tasks.py
View file @
55868fd7
...
...
@@ -4,6 +4,7 @@ Celery tasks for generating and sending digest emails.
from
contextlib
import
closing
from
datetime
import
datetime
,
timedelta
import
logging
from
requests
import
request
from
boto.ses.exceptions
import
SESMaxSendingRateExceededError
import
celery
...
...
@@ -48,9 +49,9 @@ 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
)
request
(
"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 +60,8 @@ 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