Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: better logging and exception handling for course review avg rating management command #753

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion enterprise_catalog/apps/catalog/algolia_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def set_global_course_review_avg():
return

total_average_course_rating = rolling_rating_sum / total_number_reviews

logger.info(f"set_global_course_review_avg saving average course rating value: {total_average_course_rating}")
cache.set(
DISCOVERY_AVERAGE_COURSE_REVIEW_CACHE_KEY,
total_average_course_rating,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@
"""
Fetch ContentMetadata records, read the course review values and save the average to py-cache.
"""
logger.info("compare_catalog_queries_to_filters queuing task...")
set_global_course_review_avg()
logger.info("starting set_global_average_course_rating_value task.")
try:
set_global_course_review_avg()
except Exception as exc:
logger.warning(

Check warning on line 26 in enterprise_catalog/apps/catalog/management/commands/set_global_average_course_rating_value.py

View check run for this annotation

Codecov / codecov/patch

enterprise_catalog/apps/catalog/management/commands/set_global_average_course_rating_value.py#L25-L26

Added lines #L25 - L26 were not covered by tests
f'set_global_average_course_rating_value task failed with exception: {exc}'
)
Loading