From 40674e4d1a6b7992c9a44decf6b6ad05a11e13aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 25 Jun 2019 16:05:15 +0200 Subject: [PATCH] do not warn about stale cache if not cache timeout is defined (#34319) --- mellon/adapters.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mellon/adapters.py b/mellon/adapters.py index cd7e190..368c697 100644 --- a/mellon/adapters.py +++ b/mellon/adapters.py @@ -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: