Mercurial > kallithea
changeset 1744:d41a115d9a39 beta
remove cache from default perms. In some cases of concurrent repo removal it crashed.
There's no speed regression on this one.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 01 Dec 2011 00:40:28 +0200 |
parents | db4852ed3413 |
children | 456e1e3ce4eb |
files | rhodecode/model/db.py |
diffstat | 1 files changed, 2 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/model/db.py Thu Dec 01 00:26:09 2011 +0200 +++ b/rhodecode/model/db.py Thu Dec 01 00:40:28 2011 +0200 @@ -680,7 +680,7 @@ def _c(repo_name): return self.__get_instance() rn = self.repo_name - + log.debug('Getting cached instance of repo') inv = self.invalidate if inv is not None: region_invalidate(_c, None, rn) @@ -689,9 +689,7 @@ return _c(rn) def __get_instance(self): - repo_full_path = self.repo_full_path - try: alias = get_scm(repo_full_path)[0] log.debug('Creating instance of %s repository', alias) @@ -704,7 +702,6 @@ return if alias == 'hg': - repo = backend(safe_str(repo_full_path), create=False, baseui=self._ui) # skip hidden web repository @@ -853,13 +850,11 @@ return cls.query().filter(cls.permission_name == key).scalar() @classmethod - def get_default_perms(cls, default_user_id, cache=True): + def get_default_perms(cls, default_user_id): q = Session().query(UserRepoToPerm, Repository, cls)\ .join((Repository, UserRepoToPerm.repository_id == Repository.repo_id))\ .join((cls, UserRepoToPerm.permission_id == cls.permission_id))\ .filter(UserRepoToPerm.user_id == default_user_id) - if cache: - q = q.options(FromCache("sql_cache_short", "get_default_perms")) return q.all()