fix: use non_atomic_requests decorator in handle_block view (#34020)
This commit is contained in:
@@ -6,6 +6,7 @@ from functools import partial
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.db import transaction
|
||||
from django.http import Http404, HttpResponse
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.decorators.http import require_http_methods
|
||||
@@ -74,6 +75,12 @@ NEVER = lambda x: False
|
||||
ALWAYS = lambda x: True
|
||||
|
||||
|
||||
# Disable atomic requests so transactions made during the request commit immediately instead of waiting for the end of
|
||||
# the request transaction. This is necessary so the async tasks launched by the current process can see the changes made
|
||||
# during the request. One example is the async tasks launched when courses are published before the request
|
||||
# ends, which end up reading from an outdated state of the database. For more information see the discussion in the
|
||||
# following PR: https://github.com/openedx/edx-platform/pull/34020
|
||||
@transaction.non_atomic_requests
|
||||
@require_http_methods(("DELETE", "GET", "PUT", "POST", "PATCH"))
|
||||
@login_required
|
||||
@expect_json
|
||||
|
||||
Reference in New Issue
Block a user