fix: delay creation of course topics after course publish (#31307)

When running in a sharded MongoDB setup it's possible that querying the
modulestore right after the course publish signal will not return the
latest data.

This commit adds a delay similar to the one used in other places in the
codebase for a similar reason.
This commit is contained in:
Kshitij Sobti
2022-11-18 11:49:29 +00:00
committed by GitHub
parent 5fa05289a4
commit de0b132f10
3 changed files with 4 additions and 12 deletions

View File

@@ -142,7 +142,10 @@ def listen_for_course_publish(sender, course_key, **kwargs): # pylint: disable=
if CoursewareSearchIndexer.indexing_is_enabled() and CourseAboutSearchIndexer.indexing_is_enabled():
update_search_index.delay(course_key_str, datetime.now(UTC).isoformat())
update_discussions_settings_from_course_task.delay(course_key_str)
update_discussions_settings_from_course_task.apply_async(
args=[course_key_str],
countdown=settings.DISCUSSION_SETTINGS['COURSE_PUBLISH_TASK_DELAY'],
)
# Send to a signal for catalog info changes as well, but only once we know the transaction is committed.
transaction.on_commit(lambda: emit_catalog_info_changed_signal(course_key))