From 28a9af755397262678e4676aa01f06fb5c1fc96e Mon Sep 17 00:00:00 2001 From: Johan Lundberg Date: Thu, 5 Sep 2024 10:11:08 +0200 Subject: [PATCH] do not refresh metadata on missing entities, wait for cache to expire --- src/auth_server/tls_fed_auth.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/auth_server/tls_fed_auth.py b/src/auth_server/tls_fed_auth.py index faf899e..0c2a891 100644 --- a/src/auth_server/tls_fed_auth.py +++ b/src/auth_server/tls_fed_auth.py @@ -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()