perf: upgrade XBlock to 5.1.1 for caching unknown tags

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.
This commit is contained in:
David Ormsbee
2025-01-22 10:38:10 -05:00
parent 92bc0fa763
commit 9a6cdbf8e2
5 changed files with 20 additions and 7 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -143,9 +143,22 @@ class RoundTripTestCase(unittest.TestCase):
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):