Skip to content

Commit

Permalink
fix: [AXM-791] remove unsed import and generic Exception from retry
Browse files Browse the repository at this point in the history
  • Loading branch information
NiedielnitsevIvan committed Jun 21, 2024
1 parent 2049fab commit 5210d22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions openedx/features/offline_mode/storage_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion openedx/features/offline_mode/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)
Expand Down

0 comments on commit 5210d22

Please sign in to comment.