comparison mercurial/revlog.py @ 21749:f13728d59c0e stable

revlog: make _chunkcache access atomic With this and related fixes, 'hg serve' survived 100000 hits with siege.
author Matt Mackall <mpm@selenic.com>
date Fri, 13 Jun 2014 14:16:03 -0500
parents 4a6c8b6b10d3
children 4ab287c2d337
comparison
equal deleted inserted replaced
21748:8621125a1718 21749:f13728d59c0e
917 l = [] 917 l = []
918 ladd = l.append 918 ladd = l.append
919 919
920 # preload the cache 920 # preload the cache
921 try: 921 try:
922 self._chunkraw(revs[0], revs[-1]) 922 while 1:
923 offset, data = self._chunkcache 923 # ensure that the cache doesn't change out from under us
924 _cache = self._chunkcache
925 self._chunkraw(revs[0], revs[-1])
926 if _cache == self._chunkcache:
927 break
928 offset, data = _cache
924 except OverflowError: 929 except OverflowError:
925 # issue4215 - we can't cache a run of chunks greater than 930 # issue4215 - we can't cache a run of chunks greater than
926 # 2G on Windows 931 # 2G on Windows
927 return [self._chunk(rev) for rev in revs] 932 return [self._chunk(rev) for rev in revs]
928 933