Commit 3d7a6d8b by Feanil Patel

Fix for when celery runs in eager mode.

When celery runs in eager mode, there is a bug and an exception
is not thrown when using retry logic. A PR to fix the bug can
be found here: https://github.com/celery/celery/pull/2607

In the mean time, we have to deal with the fact that in eager mode
celery will not throw the exception but simply return it. So we
raise it ourselves.
parent e4aa91d5
......@@ -773,7 +773,7 @@ def _submit_for_retry(entry_id, email_id, to_list, global_email_context, current
# needs to be returned back to Celery. If it fails, we return the existing
# exception.
try:
send_course_email.retry(
retry_task = send_course_email.retry(
args=[
entry_id,
email_id,
......@@ -786,6 +786,7 @@ def _submit_for_retry(entry_id, email_id, to_list, global_email_context, current
max_retries=max_retries,
throw=True,
)
raise retry_task
except RetryTaskError as retry_error:
# If the retry call is successful, update with the current progress:
log.exception(u'Task %s: email with id %d caused send_course_email task to retry.',
......
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