http-protocol: Invalidate the VCSServer cache when calling a writing method.
This commit is contained in:
parent
f0581979ba
commit
485c007798
1 changed files with 21 additions and 1 deletions
|
|
@ -84,6 +84,18 @@ class RepoMaker(object):
|
|||
|
||||
class RemoteRepo(object):
|
||||
|
||||
# List of method names that act like a write to the repository. After these
|
||||
# methods we have to invalidate the VCSServer cache.
|
||||
_writing_methods = [
|
||||
'bookmark',
|
||||
'commit',
|
||||
'pull',
|
||||
'pull_cmd',
|
||||
'push',
|
||||
'rebase',
|
||||
'strip',
|
||||
]
|
||||
|
||||
def __init__(self, path, config, url, session, with_wire=None):
|
||||
self.url = url
|
||||
self._session = session
|
||||
|
|
@ -116,7 +128,15 @@ class RemoteRepo(object):
|
|||
'method': name,
|
||||
'params': {'wire': wire, 'args': args, 'kwargs': kwargs}
|
||||
}
|
||||
return _remote_call(self.url, payload, EXCEPTIONS_MAP, self._session)
|
||||
|
||||
try:
|
||||
response = _remote_call(
|
||||
self.url, payload, EXCEPTIONS_MAP, self._session)
|
||||
finally:
|
||||
if name in self._writing_methods:
|
||||
self.invalidate_vcs_cache()
|
||||
|
||||
return response
|
||||
|
||||
def _call_with_logging(self, name, *args, **kwargs):
|
||||
log.debug('Calling %s@%s', self.url, name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue