comparison mercurial/hgweb/hgweb_mod.py @ 26240:2b1434e5eaa0

hg: always create new localrepository instance cachedlocalrepo.copy() didn't actually create new localrepository instances. This meant that the new thread isolation code in hgweb wasn't actually using separate localrepository instances, even though it was properly using separate cachedlocalrepo instances. Because the behavior of the API changed, the single caller in hgweb had to be refactored to always call _webifyrepo() or it may not have used the proper filter. I confirmed via print() debugging that id(repo) is in fact different on each thread. This was not the case before. For reasons I can't yet explain, this does not fix issue4756. I suspect there is shared cache somewhere that isn't thread safe.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 12 Sep 2015 11:31:56 -0700
parents efebefe162e9
children 7df5d4760873
comparison
equal deleted inserted replaced
26239:f39953663cc9 26240:2b1434e5eaa0
233 have a thread limit, thus establishing our limit. 233 have a thread limit, thus establishing our limit.
234 """ 234 """
235 if self._repos: 235 if self._repos:
236 cached = self._repos.pop() 236 cached = self._repos.pop()
237 r, created = cached.fetch() 237 r, created = cached.fetch()
238 if created:
239 r = self._webifyrepo(r)
240 else: 238 else:
241 cached = self._lastrepo.copy() 239 cached = self._lastrepo.copy()
242 r, created = cached.fetch() 240 r, created = cached.fetch()
241 if created:
242 r = self._webifyrepo(r)
243 243
244 self._lastrepo = cached 244 self._lastrepo = cached
245 self.mtime = cached.mtime 245 self.mtime = cached.mtime
246 try: 246 try:
247 yield r 247 yield r