Skip to content

Commit

Permalink
perf: upgrade XBlock to 5.1.1 for caching unknown tags
Browse files Browse the repository at this point in the history
This should improve performance for courseware operations when there is
content that doesn't map to any existing XBlocks in the system. This
usually happens to old courses when custom XBlock types are deprecated
and removed, or when a course is imported from another instance with a
different set of installed XBlocks.
  • Loading branch information
ormsbee committed Jan 22, 2025
1 parent 92bc0fa commit 9a6cdbf
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ wheel==0.45.1
# via django-pipeline
wrapt==1.17.2
# via -r requirements/edx/kernel.in
xblock[django]==5.1.0
xblock[django]==5.1.1
# via
# -r requirements/edx/kernel.in
# acid-xblock
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,7 @@ wrapt==1.17.2
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# astroid
xblock[django]==5.1.0
xblock[django]==5.1.1
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ wrapt==1.17.2
# via
# -r requirements/edx/base.txt
# astroid
xblock[django]==5.1.0
xblock[django]==5.1.1
# via
# -r requirements/edx/base.txt
# acid-xblock
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,7 @@ wrapt==1.17.2
# via
# -r requirements/edx/base.txt
# astroid
xblock[django]==5.1.0
xblock[django]==5.1.1
# via
# -r requirements/edx/base.txt
# acid-xblock
Expand Down
19 changes: 16 additions & 3 deletions xmodule/tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,22 @@ def test_export_roundtrip(self, course_dir, mock_get):

print("Checking block equality")
for location in initial_import.modules[course_id].keys():
print(("Checking", location))
assert blocks_are_equivalent(initial_import.modules[course_id][location],
second_import.modules[course_id][location])
initial_block = initial_import.modules[course_id][location]
reimported_block = second_import.modules[course_id][location]
if location.block_type == "error":
# Error blocks store their stacktrace as a field on the block
# itself. We cache failed XBlock tag -> class lookups, so a
# PluginError raised from the uncached state vs cached state
# will generate different stacktraces, making the two blocks
# "different" as far as blocks_are_equivalent() is concerned. It
# doesn't *really* matter if the stacktraces are different
# though, so we'll do a much less thorough comparison for error
# blocks:
assert type(initial_block) == type(reimported_block) # pylint:disable=unidiomatic-typecheck
assert initial_block.display_name == reimported_block.display_name
else:
print(("Checking", location))
assert blocks_are_equivalent(initial_block, reimported_block)


class TestEdxJsonEncoder(unittest.TestCase):
Expand Down

0 comments on commit 9a6cdbf

Please sign in to comment.