Mercurial > kallithea
diff rhodecode/model/scm.py @ 2352:90e06f53af8c beta
Implemented cache-map on main page to save executing select
statements that checks if cache should be invalidated.
It reduces number of executed queries from N which is number of
repos to 1 which is needed to fetch all keys from database.
On pages with large number of repos this could reduce load time by half
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 28 May 2012 16:26:47 +0200 |
parents | 19a6c23af14b |
children | f3417f0d54b5 |
line wrap: on
line diff
--- a/rhodecode/model/scm.py Mon May 28 14:42:07 2012 +0200 +++ b/rhodecode/model/scm.py Mon May 28 16:26:47 2012 +0200 @@ -77,8 +77,12 @@ return '<%s (%s)>' % (self.__class__.__name__, self.__len__()) def __iter__(self): + # pre-propagated cache_map to save executing select statements + # for each repo + cache_map = CacheInvalidation.get_cache_map() + for dbr in self.db_repo_list: - scmr = dbr.scm_instance_cached + scmr = dbr.scm_instance_cached(cache_map) # check permission at this level if not HasRepoPermissionAny( 'repository.read', 'repository.write', 'repository.admin'