Skip to content

Commit

Permalink
fix: don't log useless/opaque cache keys
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveagent57 committed Jul 31, 2023
1 parent cc09e7d commit 71544e7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions enterprise_subsidy/apps/content_metadata/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,22 @@ def get_content_metadata(enterprise_customer_uuid, content_identifier):
cache_key = content_metadata_cache_key(enterprise_customer_uuid, content_identifier)
cached_response = TieredCache.get_cached_response(cache_key)
if cached_response.is_found:
logger.info('[CONTENT METADATA CACHE HIT] for key %s', cache_key)
return cached_response.value

logger.info('[CONTENT METADATA CACHE MISS] for key %s', cache_key)
course_details = EnterpriseCatalogApiClient().get_content_metadata_for_customer(
enterprise_customer_uuid,
content_identifier
)
if course_details:
logger.info('[CONTENT METADATA CACHE SET] for key %s', cache_key)
TieredCache.set_all_tiers(
cache_key,
course_details,
django_cache_timeout=CONTENT_METADATA_CACHE_TIMEOUT,
)
logger.info(
'Fetched course details %s for customer %s and content_identifier %s',
course_details,
enterprise_customer_uuid,
content_identifier,
)
return course_details

0 comments on commit 71544e7

Please sign in to comment.