Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
4cc758da
Commit
4cc758da
authored
Jul 29, 2013
by
Kevin Luo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add retry loop to delegate_email for getting CourseEmail
Revert hardcoded delay for course_email task
parent
72f09cf3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
+14
-1
lms/djangoapps/bulk_email/tasks.py
+14
-1
No files found.
lms/djangoapps/bulk_email/tasks.py
View file @
4cc758da
...
@@ -37,6 +37,19 @@ def delegate_email_batches(hash_for_msg, recipient, course_id, course_url, user_
...
@@ -37,6 +37,19 @@ def delegate_email_batches(hash_for_msg, recipient, course_id, course_url, user_
log
.
error
(
"get_course_by_id failed: "
+
exc
.
args
[
0
])
log
.
error
(
"get_course_by_id failed: "
+
exc
.
args
[
0
])
raise
Exception
(
"get_course_by_id failed: "
+
exc
.
args
[
0
])
raise
Exception
(
"get_course_by_id failed: "
+
exc
.
args
[
0
])
email
=
None
retries
=
0
while
email
is
None
:
try
:
email
=
CourseEmail
.
objects
.
get
(
hash
=
hash_for_msg
)
except
CourseEmail
.
DoesNotExist
as
exc
:
if
retries
<
3
:
retries
+=
1
time
.
sleep
(
5
)
else
:
log
.
error
(
"Failed to get CourseEmail with hash "
+
hash_for_msg
+
", no workers fired."
)
return
0
if
recipient
==
"myself"
:
if
recipient
==
"myself"
:
recipient_qset
=
User
.
objects
.
filter
(
id
=
user_id
)
.
values
(
'profile__name'
,
'email'
)
recipient_qset
=
User
.
objects
.
filter
(
id
=
user_id
)
.
values
(
'profile__name'
,
'email'
)
else
:
else
:
...
@@ -63,7 +76,7 @@ def delegate_email_batches(hash_for_msg, recipient, course_id, course_url, user_
...
@@ -63,7 +76,7 @@ def delegate_email_batches(hash_for_msg, recipient, course_id, course_url, user_
for
i
in
range
(
num_workers
):
for
i
in
range
(
num_workers
):
to_list
=
recipient_list
[
i
*
chunk
:
i
*
chunk
+
chunk
]
to_list
=
recipient_list
[
i
*
chunk
:
i
*
chunk
+
chunk
]
course_email
.
apply_async
(
args
=
[
hash_for_msg
,
to_list
,
course
.
display_name
,
course_url
,
False
],
countdown
=
10
)
course_email
.
delay
(
hash_for_msg
,
to_list
,
course
.
display_name
,
course_url
,
False
)
return
num_workers
return
num_workers
...
...
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