Skip to content

Commit

Permalink
fix: use non_atomic_requests decorator in handle_block view (openedx#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi authored Feb 21, 2024
1 parent 31408da commit f3dab82
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cms/djangoapps/contentstore/views/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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
Expand Down Expand Up @@ -74,6 +75,12 @@
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
Expand Down

0 comments on commit f3dab82

Please sign in to comment.