@@ -2139,13 +2139,19 @@ class CacheInvalidation(Base, BaseModel)
if not inv_obj:
inv_obj = CacheInvalidation(cache_key, repo_name)
if inv_obj.cache_active:
return True
inv_obj.cache_active = True
Session().add(inv_obj)
try:
Session().commit()
except exc.IntegrityError:
inv_obj = cls.query().filter(cls.cache_key == cache_key).scalar()
raise
# TOCTOU - another thread added the key at the same time; no further action required
return False
@classmethod
def get_valid_cache_keys(cls):
"""
Return opaque object with information of which caches still are valid
Status change: