Skip to content

Commit

Permalink
fix: broken links not showing up
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperhodge committed Jan 9, 2025
1 parent 162510b commit 82b5bf6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ def generate_broken_links_descriptor(json_content, request_user):

for item in json_content:
block_id, link, *rest = item
is_locked_flag = bool(rest[0])
if rest:
is_locked_flag = bool(rest[0])
else:
is_locked_flag = False

usage_key = usage_key_with_run(block_id)
block = get_xblock(usage_key, request_user)
Expand Down
11 changes: 6 additions & 5 deletions cms/djangoapps/contentstore/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,12 +1214,13 @@ def retry_validation(url_list, course_key, retry_count=3):
for i in range(0, retry_count):
if retry_list:
LOGGER.debug(f'[Link Check] retry attempt #{i+1}')
validated_url_list = asyncio.run(validate_urls_access_in_batches(retry_list, course_key, batch_size=100))
validated_url_list = asyncio.run(
validate_urls_access_in_batches(retry_list, course_key, batch_size=100)
)
filetered_url_list, retry_list = filter_by_status(validated_url_list)
results.extend(filetered_url_list)

if retry_list:
LOGGER.debug(f'[Link Check] {len(retry_list)} requests failed due to connection error')

results.extend(retry_list)

return results

Expand All @@ -1237,7 +1238,7 @@ def filter_by_status(results):
filtered_results = []
retry_list = []
for result in results:
if result['status'] == None:
if result['status'] is None:
retry_list.append([result['block_id'], result['url']])
elif result['status'] == 200:
continue
Expand Down

0 comments on commit 82b5bf6

Please sign in to comment.