-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: don't call signal handlers like XBLOCK_UPDATED before commit #34847
fix: don't call signal handlers like XBLOCK_UPDATED before commit #34847
Conversation
Thanks for the pull request, @bradenmacdonald! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@bradenmacdonald I encountered issues when deleting content from my course in Studio (details inline), but that's not a blocker for merging here.
- I tested this on my Tutor dev stack:
- updated an existing course's structure by adding, editing, and deleting content, and ensured the changes were visible in Studio search
- I checked the code against the original Fix: sometimes, changes to subsections are not reflected in the Studio Search Index #34800 + docs: fix minor typos in the meilisearch feature configuration #34838
return xblock | ||
|
||
@strip_key | ||
def delete_item(self, location, user_id, **kwargs): # lint-amnesty, pylint: disable=arguments-differ | ||
""" | ||
Delete the given item from persistence. kwargs allow modulestore specific parameters. | ||
""" | ||
store = self._verify_modulestore_support(location.course_key, 'delete_item') | ||
course_key = location.course_key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bradenmacdonald I had issues with deleting content from my course -- deleted blocks still show up in search?
But I'm not sure if there's something wrong with my setup, because I've got redis errors in the traceback.
cms-1 | 2024-05-22 23:47:11,093 ERROR 327 [django.dispatch] [user 6] [ip 172.18.0.1] dispatcher.py:213 - Error calling handle_item_deleted in Signal.send_robust() (BlockKey(type='vertical', id='f69a018879e5421f93fc631e8edd15da'))
cms-1 | Traceback (most recent call last):
cms-1 | File "/openedx/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 211, in send_robust
cms-1 | response = receiver(signal=self, sender=sender, **named)
cms-1 | File "/openedx/edx-platform/cms/djangoapps/contentstore/signals/handlers.py", line 207, in handle_item_deleted
cms-1 | deleted_block = modulestore().get_item(usage_key)
cms-1 | File "/openedx/edx-platform/xmodule/modulestore/mixed.py", line 90, in inner
cms-1 | retval = func(field_decorator=strip_key_collection, *args, **kwargs)
cms-1 | File "/openedx/edx-platform/xmodule/modulestore/mixed.py", line 257, in get_item
cms-1 | return store.get_item(usage_key, depth, **kwargs)
cms-1 | File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split_draft.py", line 283, in get_item
cms-1 | return super().get_item(usage_key, depth=depth, **kwargs)
cms-1 | File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split.py", line 1183, in get_item
cms-1 | items = self._load_items(course, [BlockKey.from_usage_key(usage_key)], depth, **kwargs)
cms-1 | File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split.py", line 780, in _load_items
cms-1 | return [runtime.load_item(block_key, course_entry, **kwargs) for block_key in block_keys]
cms-1 | File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split.py", line 780, in <listcomp>
cms-1 | return [runtime.load_item(block_key, course_entry, **kwargs) for block_key in block_keys]
cms-1 | File "/openedx/edx-platform/xmodule/modulestore/split_mongo/caching_descriptor_system.py", line 127, in _load_item
cms-1 | block_data = self.get_module_data(block_key, course_key)
cms-1 | File "/openedx/edx-platform/xmodule/modulestore/split_mongo/caching_descriptor_system.py", line 154, in get_module_data
cms-1 | raise ItemNotFoundError(block_key)
cms-1 | xmodule.modulestore.exceptions.ItemNotFoundError: BlockKey(type='vertical', id='f69a018879e5421f93fc631e8edd15da')
cms-1 | 2024-05-22 23:47:11,094 INFO 327 [xmodule.modulestore.django] [user 6] [ip 172.18.0.1] django.py:220 - Sent item_deleted signal to <function handle_item_deleted at 0x7f831eca1e50> with kwargs {'usage_key': BlockUsageLocator(CourseLocator('SampleTaxonomyOrg2', 'STC1', '2023_1', 'draft-branch', None), 'vertical', 'f69a018879e5421f93fc631e8edd15da'), 'user_id': 6}. Response was: BlockKey(type='vertical', id='f69a018879e5421f93fc631e8edd15da')
cms-1 | 2024-05-22 23:47:11,200 INFO 327 [celery_utils.logged_task] [user 6] [ip 172.18.0.1] logged_task.py:25 - Task openedx.core.djangoapps.content.search.tasks.delete_xblock_index_doc[5f07654a-aeda-4b2d-b8f2-efd41ae30445] submitted with arguments ('block-v1:SampleTaxonomyOrg2+STC1+2023_1+type@vertical+block@f69a018879e5421f93fc631e8edd15da',), {}
cms-1 | 2024-05-22 23:47:11,214 ERROR 327 [edx_event_bus_redis.internal.producer] [user 6] [ip 172.18.0.1] producer.py:51 - Error delivering message to Redis event bus. error=Error -2 connecting to edx.devstack.redis:6379. Name or service not known. full_topic='dev-course-authoring-xblock-lifecycle' event_key=None signal=<OpenEdxPublicSignal: org.openedx.content_authoring.xblock.deleted.v1> initial_topic='course-authoring-xblock-lifecycle' event_key_field='xblock_info.usage_key' event_data={'xblock_info': XBlockData(usage_key=BlockUsageLocator(CourseLocator('SampleTaxonomyOrg2', 'STC1', '2023_1', None, None), 'vertical', 'f69a018879e5421f93fc631e8edd15da'), block_type='vertical', version=None)} event_metadata=EventsMetadata(event_type='org.openedx.content_authoring.xblock.deleted.v1', id=UUID('9b992d54-1895-11ef-9c09-0242ac120009'), minorversion=0, source='openedx/cms/web', sourcehost='eab1bef4bb21', time=datetime.datetime(2024, 5, 22, 23, 47, 11, 147475, tzinfo=datetime.timezone.utc), sourcelib=(9, 9, 2))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pomegranited I encountered the same errors in my logs as well, however the deleted blocks do not show up in the search.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me @bradenmacdonald
- I tested this: I made sure the the index is properly updating when creating/updating/deleteing, when running locally with celery
- I read through the code
-
I checked for accessibility issues - Includes documentation
Hmm, not sure what those errors are about, but it does seem they're unrelated to this issue, so we can investigate them separately as needed. Thanks for the reviews! |
801680e
into
openedx:open-release/redwood.master
@bradenmacdonald 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Description
This backports an import fix, #34800, to Redwood. I also included #34838, a tiny fix to some comments (no code changes).
Without this fix, authors may make changes to course content in Studio but won't see those changes when they use the new studio course search feature; the search index would only show an older version of the content.
Supporting information
See #34800
Testing instructions
Deadline
Ideally before Redwood official release
Private ref: FAL-3715