Changeset - 041e8a5a2246
[Not reviewed]
default
0 1 0
Mads Kiilerich - 10 years ago 2016-03-14 16:17:46
madski@unity3d.com
db: inline repo __get_instance to scm_instance_no_cache

Having two names for the same thing just made it look even more complicated
than it is.

There _should_ not be any reason for calling scm_instance_no_cache directly
anywhere ... but for now that is how it is.
1 file changed with 2 insertions and 5 deletions:
0 comments (0 inline, 0 general)
kallithea/model/db.py
Show inline comments
 
@@ -1437,9 +1437,6 @@ class Repository(Base, BaseModel):
 
        """
 
        CacheInvalidation.set_invalidate(self.repo_name)
 

	
 
    def scm_instance_no_cache(self):
 
        return self.__get_instance()
 

	
 
    @property
 
    def scm_instance(self):
 
        import kallithea
 
@@ -1452,7 +1449,7 @@ class Repository(Base, BaseModel):
 
        @cache_region('long_term')
 
        def _c(repo_name): # repo_name is just for the cache key
 
            log.debug('Creating new %s scm_instance and populating cache', repo_name)
 
            return self.__get_instance()
 
            return self.scm_instance_no_cache()
 
        rn = self.repo_name
 

	
 
        valid = CacheInvalidation.test_and_set_valid(rn, None, valid_cache_keys=valid_cache_keys)
 
@@ -1463,7 +1460,7 @@ class Repository(Base, BaseModel):
 
            log.debug('Trying to get scm_instance of %s from cache', rn)
 
        return _c(rn)
 

	
 
    def __get_instance(self):
 
    def scm_instance_no_cache(self):
 
        repo_full_path = safe_str(self.repo_full_path)
 
        alias = get_scm(repo_full_path)[0]
 
        log.debug('Creating instance of %s repository from %s',
0 comments (0 inline, 0 general)