fix(cache-invalidation): fixed case when empty repos once cached wouldn't invalidate caches because of empty case condition

This commit is contained in:
RhodeCode Admin 2024-02-15 14:24:48 +01:00
parent 135a6105d4
commit ff624f6bb9

View file

@ -2634,12 +2634,11 @@ class Repository(Base, BaseModel):
previous_state_uid, instance = cache_func(*args)
if instance:
# now compare keys, the "cache" state vs expected state.
if previous_state_uid != cache_state_uid:
log.warning('Cached state uid %s is different than current state uid %s',
previous_state_uid, cache_state_uid)
_, instance = cache_func.refresh(*args)
# now compare keys, the "cache" state vs expected state.
if previous_state_uid != cache_state_uid:
log.warning('Cached state uid %s is different than current state uid %s',
previous_state_uid, cache_state_uid)
_, instance = cache_func.refresh(*args)
log.debug('Repo instance fetched in %.4fs', inv_context_manager.compute_time)
return instance
@ -2652,6 +2651,7 @@ class Repository(Base, BaseModel):
'cache': cache, # controls the vcs.remote cache
'repo_state_uid': repo_state_uid
}
repo = get_vcs_instance(
repo_path=safe_str(self.repo_full_path),
config=config,