From 5a730aa934b17f1910464b83c631f693014fabe9 Mon Sep 17 00:00:00 2001 From: Adeel Khan Date: Thu, 12 Jul 2018 16:03:33 +0500 Subject: [PATCH] Improve CourseListView end point latency by removing CourseWaffleFlag. This patch would remove CourseListView slow transaction by changing CourseWaffleFlag to WaffleFlag. This removes extra hit on WaffleUtil's model (WaffleFlagCourseOverrideModel). LEARNER-5566 --- lms/djangoapps/courseware/access_utils.py | 2 +- openedx/features/course_experience/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/courseware/access_utils.py b/lms/djangoapps/courseware/access_utils.py index 5a9084e8c5..e0def5cebd 100644 --- a/lms/djangoapps/courseware/access_utils.py +++ b/lms/djangoapps/courseware/access_utils.py @@ -91,6 +91,6 @@ def check_course_open_for_learner(user, course): Returns: AccessResponse: Either ACCESS_GRANTED or StartDateError. """ - if COURSE_PRE_START_ACCESS_FLAG.is_enabled(course.id): + if COURSE_PRE_START_ACCESS_FLAG.is_enabled(): return ACCESS_GRANTED return check_start_date(user, course.days_early_for_beta, course.start, course.id) diff --git a/openedx/features/course_experience/__init__.py b/openedx/features/course_experience/__init__.py index c5dd98b9ed..7741d2bc12 100644 --- a/openedx/features/course_experience/__init__.py +++ b/openedx/features/course_experience/__init__.py @@ -4,7 +4,7 @@ Unified course experience settings and helper methods. from django.utils.translation import ugettext as _ from openedx.core.djangoapps.util.user_messages import UserMessageCollection -from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlagNamespace +from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlagNamespace, WaffleFlag # Namespace for course experience waffle flags. @@ -20,7 +20,7 @@ UNIFIED_COURSE_TAB_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'unified_cours DISPLAY_COURSE_SOCK_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'display_course_sock') # Waffle flag to let learners access a course before its start date. -COURSE_PRE_START_ACCESS_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'pre_start_access') +COURSE_PRE_START_ACCESS_FLAG = WaffleFlag(WAFFLE_FLAG_NAMESPACE, 'pre_start_access') # Waffle flag to enable a review page link from the unified home page. SHOW_REVIEWS_TOOL_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'show_reviews_tool')