Skip to content

Commit 9a6cdbf

Browse files
committed
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.
1 parent 92bc0fa commit 9a6cdbf

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

requirements/edx/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ wheel==0.45.1
12561256
# via django-pipeline
12571257
wrapt==1.17.2
12581258
# via -r requirements/edx/kernel.in
1259-
xblock[django]==5.1.0
1259+
xblock[django]==5.1.1
12601260
# via
12611261
# -r requirements/edx/kernel.in
12621262
# acid-xblock

requirements/edx/development.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2253,7 +2253,7 @@ wrapt==1.17.2
22532253
# -r requirements/edx/doc.txt
22542254
# -r requirements/edx/testing.txt
22552255
# astroid
2256-
xblock[django]==5.1.0
2256+
xblock[django]==5.1.1
22572257
# via
22582258
# -r requirements/edx/doc.txt
22592259
# -r requirements/edx/testing.txt

requirements/edx/doc.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ wrapt==1.17.2
15831583
# via
15841584
# -r requirements/edx/base.txt
15851585
# astroid
1586-
xblock[django]==5.1.0
1586+
xblock[django]==5.1.1
15871587
# via
15881588
# -r requirements/edx/base.txt
15891589
# acid-xblock

requirements/edx/testing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ wrapt==1.17.2
16731673
# via
16741674
# -r requirements/edx/base.txt
16751675
# astroid
1676-
xblock[django]==5.1.0
1676+
xblock[django]==5.1.1
16771677
# via
16781678
# -r requirements/edx/base.txt
16791679
# acid-xblock

xmodule/tests/test_export.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,22 @@ def test_export_roundtrip(self, course_dir, mock_get):
143143

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

150163

151164
class TestEdxJsonEncoder(unittest.TestCase):

0 commit comments

Comments
 (0)