caches: allow cache disable for file tree
This commit is contained in:
parent
1b48364bb6
commit
3ab8040abf
3 changed files with 10 additions and 9 deletions
|
|
@ -27,7 +27,7 @@ from pyramid.httpexceptions import HTTPFound, HTTPForbidden, HTTPBadRequest
|
|||
|
||||
from rhodecode.lib import helpers as h, diffs
|
||||
from rhodecode.lib.utils2 import (
|
||||
StrictAttributeDict, safe_int, datetime_to_time, safe_unicode)
|
||||
StrictAttributeDict, str2bool, safe_int, datetime_to_time, safe_unicode)
|
||||
from rhodecode.lib.vcs.exceptions import RepositoryRequirementError
|
||||
from rhodecode.model import repo
|
||||
from rhodecode.model import repo_group
|
||||
|
|
@ -278,6 +278,13 @@ class RepoAppView(BaseAppView):
|
|||
settings = settings_model.get_general_settings()
|
||||
return settings.get(settings_key, default)
|
||||
|
||||
def get_recache_flag(self):
|
||||
for flag_name in ['force_recache', 'force-recache', 'no-cache']:
|
||||
flag_val = self.request.GET.get(flag_name)
|
||||
if str2bool(flag_val):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class PathFilter(object):
|
||||
|
||||
|
|
|
|||
|
|
@ -229,10 +229,11 @@ class RepoFilesView(RepoAppView):
|
|||
self, c, commit_id, f_path, full_load=False):
|
||||
|
||||
repo_id = self.db_repo.repo_id
|
||||
force_recache = self.get_recache_flag()
|
||||
|
||||
cache_seconds = safe_int(
|
||||
rhodecode.CONFIG.get('rc_cache.cache_repo.expiration_time'))
|
||||
cache_on = cache_seconds > 0
|
||||
cache_on = not force_recache and cache_seconds > 0
|
||||
log.debug(
|
||||
'Computing FILE TREE for repo_id %s commit_id `%s` and path `%s`'
|
||||
'with caching: %s[TTL: %ss]' % (
|
||||
|
|
|
|||
|
|
@ -137,13 +137,6 @@ class RepoPullRequestsView(RepoAppView, DataGridAppView):
|
|||
})
|
||||
return data
|
||||
|
||||
def get_recache_flag(self):
|
||||
for flag_name in ['force_recache', 'force-recache', 'no-cache']:
|
||||
flag_val = self.request.GET.get(flag_name)
|
||||
if str2bool(flag_val):
|
||||
return True
|
||||
return False
|
||||
|
||||
@LoginRequired()
|
||||
@HasRepoPermissionAnyDecorator(
|
||||
'repository.read', 'repository.write', 'repository.admin')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue