Mercurial > hg
changeset 21750:4ab287c2d337 stable
revlog: hold a private reference to self._cache
This keeps other threads from modifying self._cache out from under us.
With this and the previous fix, 'hg serve' survives 100k hits with siege.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 13 Jun 2014 14:17:14 -0500 |
parents | f13728d59c0e |
children | c5699c2d690b e250a482478e |
files | mercurial/revlog.py |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Fri Jun 13 14:16:03 2014 -0500 +++ b/mercurial/revlog.py Fri Jun 13 14:17:14 2014 -0500 @@ -972,13 +972,14 @@ node = nodeorrev rev = None + _cache = self._cache # grab local copy of cache to avoid thread race cachedrev = None if node == nullid: return "" - if self._cache: - if self._cache[0] == node: - return self._cache[2] - cachedrev = self._cache[1] + if _cache: + if _cache[0] == node: + return _cache[2] + cachedrev = _cache[1] # look up what we need to read text = None @@ -1006,7 +1007,7 @@ if iterrev == cachedrev: # cache hit - text = self._cache[2] + text = _cache[2] else: chain.append(iterrev) chain.reverse()