diff --git a/openedx/features/offline_mode/storage_management.py b/openedx/features/offline_mode/storage_management.py index a77cf606c853..92658b68c1af 100644 --- a/openedx/features/offline_mode/storage_management.py +++ b/openedx/features/offline_mode/storage_management.py @@ -13,7 +13,7 @@ from openedx.core.storage import get_storage from zipfile import ZipFile -from .assets_management import block_storage_path, clean_outdated_xblock_files, is_modified +from .assets_management import block_storage_path, clean_outdated_xblock_files from .html_manipulator import HtmlManipulator from .renderer import XBlockRenderer @@ -48,20 +48,17 @@ def render_block_html_data(self): """ try: return XBlockRenderer(str(self.xblock.location)).render_xblock_from_lms() - except Http404: + except Http404 as e: log.error( f'Block {str(self.xblock.location)} cannot be fetched from course' f' {self.xblock.location.course_key} during offline content generation.' ) - return None + raise e def generate_offline_content(self): """ Generates archive with XBlock content for offline mode. """ - if not self.html_data: - return - base_path = block_storage_path(self.xblock) clean_outdated_xblock_files(self.xblock) tmp_dir = mkdtemp() diff --git a/openedx/features/offline_mode/tasks.py b/openedx/features/offline_mode/tasks.py index bbd9db524778..0fe4de0f51cd 100644 --- a/openedx/features/offline_mode/tasks.py +++ b/openedx/features/offline_mode/tasks.py @@ -30,7 +30,7 @@ def generate_offline_content_for_course(course_id): @shared_task( - autoretry_for=(Exception, Http404), + autoretry_for=(Http404,), retry_backoff=RETRY_BACKOFF_INITIAL_TIMEOUT, retry_kwargs={'max_retries': MAX_RETRY_ATTEMPTS} )