From 5210d2289e3ddbeaec0e0e39c65eec85372e74d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Fri, 21 Jun 2024 09:57:50 +0300 Subject: [PATCH] fix: [AXM-791] remove unsed import and generic Exception from retry --- openedx/features/offline_mode/storage_management.py | 9 +++------ openedx/features/offline_mode/tasks.py | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) 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} )