Mercurial > kallithea
changeset 3043:b61824e61e68 beta
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
can break badly. We need to create Repo() objects always for each call, even when it's
taken from cache.
Fixed issue with dulwich filedescriptor leak ref #573
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 29 Nov 2012 19:29:33 +0100 |
parents | 303878dc3dac |
children | c57a37430dc9 |
files | rhodecode/lib/vcs/backends/git/repository.py |
diffstat | 1 files changed, 20 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/lib/vcs/backends/git/repository.py Thu Nov 29 19:24:44 2012 +0100 +++ b/rhodecode/lib/vcs/backends/git/repository.py Thu Nov 29 19:29:33 2012 +0100 @@ -54,7 +54,18 @@ update_after_clone=False, bare=False): self.path = abspath(repo_path) - self._repo = self._get_repo(create, src_url, update_after_clone, bare) + repo = self._get_repo(create, src_url, update_after_clone, bare) + self.bare = repo.bare + + self._config_files = [ + bare and abspath(self.path, 'config') or abspath(self.path, '.git', + 'config'), + abspath(get_user_home(), '.gitconfig'), + ] + + @property + def _repo(self): + repo = Repo(self.path) #temporary set that to now at later we will move it to constructor baseui = None if baseui is None: @@ -62,19 +73,15 @@ baseui = ui() # patch the instance of GitRepo with an "FAKE" ui object to add # compatibility layer with Mercurial - setattr(self._repo, 'ui', baseui) - - try: - self.head = self._repo.head() - except KeyError: - self.head = None + setattr(repo, 'ui', baseui) + return repo - self._config_files = [ - bare and abspath(self.path, 'config') or abspath(self.path, '.git', - 'config'), - abspath(get_user_home(), '.gitconfig'), - ] - self.bare = self._repo.bare + @property + def head(self): + try: + return self._repo.head() + except KeyError: + return None @LazyProperty def revisions(self):