From 9db1b9cc1b375a84c788e69a7e03485399ae8cd7 Mon Sep 17 00:00:00 2001 From: Qubad786 Date: Thu, 4 May 2017 21:31:08 +0500 Subject: [PATCH] address feedback --- .../djangoapps/content/course_overviews/models.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/openedx/core/djangoapps/content/course_overviews/models.py b/openedx/core/djangoapps/content/course_overviews/models.py index 0935ea3880..05d7c0c96e 100644 --- a/openedx/core/djangoapps/content/course_overviews/models.py +++ b/openedx/core/djangoapps/content/course_overviews/models.py @@ -226,11 +226,22 @@ class CourseOverview(TimeStampedModel): ]) CourseOverviewImageSet.create_or_update(course_overview, course) + except IntegrityError: + # There is a rare race condition that will occur if + # CourseOverview.get_from_id is called while a + # another identical overview is already in the process + # of being created. + # One of the overviews will be saved normally, while the + # other one will cause an IntegrityError because it tries + # to save a duplicate. + # (see: https://openedx.atlassian.net/browse/TNL-2854). + pass except Exception: # pylint: disable=broad-except log.exception( "CourseOverview for course %s failed!", course_id, ) + raise return course_overview elif course is not None: