From e8f109a3286d0ae900105aae5f4c141f832853ff Mon Sep 17 00:00:00 2001 From: attiyaishaque Date: Tue, 27 Sep 2016 17:21:24 +0500 Subject: [PATCH] Revert "ECOM-5281 Add retires for email sending while registering." This reverts commit 4bbeaf32aeb343b323b7cada2b959987a9fa990c. --- cms/envs/test.py | 3 --- common/djangoapps/student/views.py | 41 +++++++++++------------------- lms/envs/common.py | 3 --- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/cms/envs/test.py b/cms/envs/test.py index 0a7b75f772..5074c48d98 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -335,6 +335,3 @@ INSTALLED_APPS += ('openedx.core.djangoapps.api_admin',) # Set the default Oauth2 Provider Model so that migrations can run in # verbose mode OAUTH2_PROVIDER_APPLICATION_MODEL = 'oauth2_provider.Application' - -# Used with Email sending -RETRY_ACTIVATION_EMAIL_MAX_ATTEMPTS = 5 diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index b63d293999..45c8b75541 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -1791,32 +1791,21 @@ def create_account_with_params(request, params): 'email_from_address', settings.DEFAULT_FROM_EMAIL ) - retries = settings.RETRY_ACTIVATION_EMAIL_MAX_ATTEMPTS - while retries: - try: - if settings.FEATURES.get('REROUTE_ACTIVATION_EMAIL'): - dest_addr = settings.FEATURES['REROUTE_ACTIVATION_EMAIL'] - message = ("Activation for %s (%s): %s\n" % (user, user.email, profile.name) + - '-' * 80 + '\n\n' + message) - mail.send_mail(subject, message, from_address, [dest_addr], fail_silently=False) - else: - user.email_user(subject, message, from_address) - # Log that the Activation Email has been sent to user without an exception - log.info("Activataion Email has been sent to User {user_email}".format( - user_email=dest_addr - )) - break - except Exception: # pylint: disable=broad-except - retries -= 1 - if retries <= 0: - break - log.error( - u'Unable to send activation email to user from "%s" to "%s"', - from_address, - dest_addr, - exc_info=True - ) - + try: + if settings.FEATURES.get('REROUTE_ACTIVATION_EMAIL'): + dest_addr = settings.FEATURES['REROUTE_ACTIVATION_EMAIL'] + message = ("Activation for %s (%s): %s\n" % (user, user.email, profile.name) + + '-' * 80 + '\n\n' + message) + mail.send_mail(subject, message, from_address, [dest_addr], fail_silently=False) + else: + user.email_user(subject, message, from_address) + except Exception: # pylint: disable=broad-except + log.error( + u'Unable to send activation email to user from "%s" to "%s"', + from_address, + dest_addr, + exc_info=True + ) else: registration.activate() _enroll_user_in_pending_courses(user) # Enroll student in any pending courses diff --git a/lms/envs/common.py b/lms/envs/common.py index 5bce4db235..0dc4b47b0a 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -370,9 +370,6 @@ GENERATE_PROFILE_SCORES = False # Used with XQueue XQUEUE_WAITTIME_BETWEEN_REQUESTS = 5 # seconds -# Used with Email sending -RETRY_ACTIVATION_EMAIL_MAX_ATTEMPTS = 5 - ############################# SET PATH INFORMATION ############################# PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /edx-platform/lms