changeset 7994:77a0fc238cee

home: drop disabled caching of repo_switcher_data The caching condition has been False since ffd45b185016 . That makes sense - caching as implemented would leak the repo list of other users without considering permissions. The repo list is however only loaded on demand, and caching is not that important.
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 16 Nov 2019 15:35:22 +0100
parents a99b7e388979
children 394c7814e710
files kallithea/controllers/home.py
diffstat 1 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/home.py	Mon Nov 11 01:56:23 2019 +0100
+++ b/kallithea/controllers/home.py	Sat Nov 16 15:35:22 2019 +0100
@@ -37,7 +37,6 @@
 from kallithea.lib import helpers as h
 from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
 from kallithea.lib.base import BaseController, jsonify, render
-from kallithea.lib.utils import conditional_cache
 from kallithea.model.db import RepoGroup, Repository, User, UserGroup
 from kallithea.model.repo import RepoModel
 from kallithea.model.scm import UserGroupList
@@ -67,9 +66,7 @@
     @LoginRequired(allow_default_user=True)
     @jsonify
     def repo_switcher_data(self):
-        # wrapper for conditional cache
-        def _c():
-            log.debug('generating switcher repo/groups list')
+        if request.is_xhr:
             all_repos = Repository.query(sorted=True).all()
             repo_iter = self.scm_model.get_repos(all_repos)
             all_groups = RepoGroup.query(sorted=True).all()
@@ -102,11 +99,6 @@
             }
             return data
 
-        if request.is_xhr:
-            condition = False
-            compute = conditional_cache('short_term', 'cache_desc',
-                                        condition=condition, func=_c)
-            return compute()
         else:
             raise HTTPBadRequest()