diff --git a/vcsserver/git.py b/vcsserver/git.py --- a/vcsserver/git.py +++ b/vcsserver/git.py @@ -140,7 +140,6 @@ class GitRemote(RemoteBase): "parents": self.parents, "_commit": self.revision, } - self.region = self._factory._cache_region def _wire_to_config(self, wire): if 'config' in wire: diff --git a/vcsserver/hg.py b/vcsserver/hg.py --- a/vcsserver/hg.py +++ b/vcsserver/hg.py @@ -169,7 +169,6 @@ class HgRemote(RemoteBase): "hidden": self.ctx_hidden, "_file_paths": self.ctx_list, } - self.region = self._factory._cache_region def _get_ctx(self, repo, ref): return get_ctx(repo, ref) @@ -652,6 +651,7 @@ class HgRemote(RemoteBase): @reraise_safe_exceptions def rev_range(self, wire, commit_filter): cache_on, context_uid, repo_id = self._cache_on(wire) + @self.region.conditional_cache_on_arguments(condition=cache_on) def _rev_range(_context_uid, _repo_id, _filter): repo = self._factory.repo(wire) diff --git a/vcsserver/svn.py b/vcsserver/svn.py --- a/vcsserver/svn.py +++ b/vcsserver/svn.py @@ -115,7 +115,6 @@ class SvnRemote(RemoteBase): # TODO: Remove once we do not use internal Mercurial objects anymore # for subversion self._hg_factory = hg_factory - self.region = self._factory._cache_region @reraise_safe_exceptions def discover_svn_version(self): diff --git a/vcsserver/vcs_base.py b/vcsserver/vcs_base.py --- a/vcsserver/vcs_base.py +++ b/vcsserver/vcs_base.py @@ -19,6 +19,10 @@ class RemoteBase(object): EMPTY_COMMIT = '0' * 40 + @property + def region(self): + return self._factory._cache_region + def _cache_on(self, wire): context = wire.get('context', '') context_uid = '{}'.format(context)