From ff624f6bb9b181bc0e550d6fc4748f67c5ddb7e5 Mon Sep 17 00:00:00 2001 From: RhodeCode Admin Date: Thu, 15 Feb 2024 14:24:48 +0100 Subject: [PATCH] fix(cache-invalidation): fixed case when empty repos once cached wouldn't invalidate caches because of empty case condition --- rhodecode/model/db.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py index 3f543414..34d74e5f 100644 --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -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,