Skip to content

Commit

Permalink
do not refresh metadata on missing entities, wait for cache to expire
Browse files Browse the repository at this point in the history
  • Loading branch information
johanlundberg committed Sep 5, 2024
1 parent e1d31f6 commit 28a9af7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/auth_server/tls_fed_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ async def get_entity(entity_id: str) -> Optional[MetadataEntity]:
now = utc_now()

for issuer, issuer_metadata in metadata.issuer_metadata.items():
# Check if metadata should be refreshed or if it is missing entities
if now > issuer_metadata.renew_at or not issuer_metadata.entities:
logger.info(f"{issuer} metadata cache has expired {issuer_metadata.renew_at} or no entities found")
# Check if metadata should be refreshed
if now > issuer_metadata.renew_at:
logger.info(f"{issuer} metadata cache has expired {issuer_metadata.renew_at}")
logger.debug(f"Cache info: {get_tls_fed_metadata.cache_info()}")
# clear lru_cache and reload metadata
get_tls_fed_metadata.cache_clear()
Expand Down

0 comments on commit 28a9af7

Please sign in to comment.