Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion openedx/core/djangoapps/content/block_structure/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Signal handlers for invalidating cached data.
"""

import logging

import six
from django.conf import settings
Expand All @@ -12,8 +13,11 @@

from . import config
from .api import clear_course_from_cache
from .models import BlockStructureNotFound
from .tasks import update_course_in_cache_v2

log = logging.getLogger(__name__)


@receiver(SignalHandler.course_published)
def update_block_structure_on_course_publish(sender, course_key, **kwargs): # pylint: disable=unused-argument
Expand All @@ -26,7 +30,13 @@ def update_block_structure_on_course_publish(sender, course_key, **kwargs): # p
return

if config.waffle().is_enabled(config.INVALIDATE_CACHE_ON_PUBLISH):
clear_course_from_cache(course_key)
try:
clear_course_from_cache(course_key)
except BlockStructureNotFound:
log.warning(
u"BlockStructure: %s not found when trying to clear course from cache",
course_key,
)

update_course_in_cache_v2.apply_async(
kwargs=dict(course_id=six.text_type(course_key)),
Expand Down