adapters: update cache file ctime on refresh (#86977)
gitea/django-mellon/pipeline/head Build queued... Details

This commit is contained in:
Benjamin Dauvergne 2024-02-14 18:37:43 +01:00
parent 244ca2abcd
commit b372884c2d
1 changed files with 3 additions and 1 deletions

View File

@ -196,7 +196,7 @@ class DefaultAdapter:
)
return
if idp.get('METADATA') != response.text:
if idp.get('METADATA') != response.text or not os.path.exists(file_cache_path):
idp['METADATA'] = response.text
logger.info('mellon: metadata url %s updated', url)
idp['METADATA_LAST_UPDATE'] = now
@ -211,6 +211,8 @@ class DefaultAdapter:
file_cache_path,
e,
)
else:
os.utime(file_cache_path)
finally:
# release thread object
idp.pop('METADATA_URL_UPDATE_THREAD', None)