caches: invalidate cache on remote side from repo settings alongside local cache.

This commit is contained in:
RhodeCode Admin 2021-12-16 14:26:38 +01:00
parent b7718f5e2d
commit 86f1961de4
2 changed files with 17 additions and 4 deletions

View file

@ -66,18 +66,28 @@ class RepoCachesView(RepoAppView):
_ = self.request.translate
c = self.load_default_context()
c.active = 'caches'
invalidated = 0
try:
ScmModel().mark_for_invalidation(self.db_repo_name, delete=True)
Session().commit()
h.flash(_('Cache invalidation successful'),
category='success')
invalidated +=1
except Exception:
log.exception("Exception during cache invalidation")
h.flash(_('An error occurred during cache invalidation'),
category='error')
try:
invalidated += 1
self.rhodecode_vcs_repo.vcsserver_invalidate_cache(delete=True)
except Exception:
log.exception("Exception during vcsserver cache invalidation")
h.flash(_('An error occurred during vcsserver cache invalidation'),
category='error')
if invalidated:
h.flash(_('Cache invalidation successful. Stages {}/2').format(invalidated),
category='success')
raise HTTPFound(h.route_path(
'edit_repo_caches', repo_name=self.db_repo_name))

View file

@ -875,6 +875,9 @@ class BaseRepository(object):
def get_hooks_info(self):
return self._remote.get_hooks_info()
def vcsserver_invalidate_cache(self, delete=False):
return self._remote.vcsserver_invalidate_cache(delete)
class BaseCommit(object):
"""