do not warn about stale cache if not cache timeout is defined (#34319)

This commit is contained in:
Frédéric Péters 2019-06-25 16:05:15 +02:00
parent 39e2e7e5ac
commit 40674e4d1a
1 changed files with 5 additions and 4 deletions

View File

@ -187,10 +187,11 @@ class DefaultAdapter(object):
# release thread object
idp.pop('METADATA_URL_UPDATE_THREAD', None)
# emit an error if cache is too old
stale_timeout = 24 * metadata_cache_time
if last_update and (now - idp['METADATA_URL_LAST_UPDATE']) > stale_timeout:
logger.error('metadata url %s : not updated since %.1f hours',
stale_timeout / 3600.0)
if metadata_cache_time:
stale_timeout = 24 * metadata_cache_time
if last_update and (now - idp['METADATA_URL_LAST_UPDATE']) > stale_timeout:
logger.error('metadata url %s : not updated since %.1f hours',
stale_timeout / 3600.0)
# we have cache, update in background
if last_update and 'METADATA' in idp: