Changeset - b61824e61e68
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-11-29 19:29:33
marcin@python-works.com
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
1 file changed with 20 insertions and 13 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/vcs/backends/git/repository.py
Show inline comments
 
@@ -54,7 +54,18 @@ class GitRepository(BaseRepository):
 
                 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 @@ class GitRepository(BaseRepository):
 
            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):
0 comments (0 inline, 0 general)