Skip to content

Commit 6432306

Browse files
committed
fix: wrap enrollment sync process in a transaction to ensure atomicity
1 parent 12ff61d commit 6432306

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • lms/djangoapps/instructor/views

lms/djangoapps/instructor/views/api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,9 +812,10 @@ def _process_student_enrollment(self, request, course_id, data, secure): # pyli
812812
"total_students": len(identifiers),
813813
}
814814

815-
return self._process_enrollment_sync(
816-
request.user, course_key, action, identifiers, auto_enroll, email_students, reason, secure
817-
)
815+
with transaction.atomic():
816+
return self._process_enrollment_sync(
817+
request.user, course_key, action, identifiers, auto_enroll, email_students, reason, secure
818+
)
818819

819820
def _process_enrollment_sync(
820821
self,

0 commit comments

Comments
 (0)