Show More
@@ -40,7 +40,7 b' from rhodecode.lib.auth import LoginRequ' | |||
|
40 | 40 | HasPermissionAnyDecorator, HasRepoPermissionAllDecorator, NotAnonymous,\ |
|
41 | 41 | HasPermissionAny, HasReposGroupPermissionAny, HasRepoPermissionAnyDecorator |
|
42 | 42 | from rhodecode.lib.base import BaseRepoController, render |
|
43 |
from rhodecode.lib.utils import |
|
|
43 | from rhodecode.lib.utils import action_logger, repo_name_slug | |
|
44 | 44 | from rhodecode.lib.helpers import get_token |
|
45 | 45 | from rhodecode.model.meta import Session |
|
46 | 46 | from rhodecode.model.db import User, Repository, UserFollowing, RepoGroup,\ |
@@ -262,7 +262,7 b' class ReposController(BaseRepoController' | |||
|
262 | 262 | try: |
|
263 | 263 | form_result = _form.to_python(dict(request.POST)) |
|
264 | 264 | repo = repo_model.update(repo_name, **form_result) |
|
265 | invalidate_cache('get_repo_cached_%s' % repo_name) | |
|
265 | ScmModel().mark_for_invalidation(repo_name) | |
|
266 | 266 | h.flash(_('Repository %s updated successfully') % repo_name, |
|
267 | 267 | category='success') |
|
268 | 268 | changed_name = repo.repo_name |
@@ -315,7 +315,7 b' class ReposController(BaseRepoController' | |||
|
315 | 315 | repo_model.delete(repo, forks=handle_forks) |
|
316 | 316 | action_logger(self.rhodecode_user, 'admin_deleted_repo', |
|
317 | 317 | repo_name, self.ip_addr, self.sa) |
|
318 | invalidate_cache('get_repo_cached_%s' % repo_name) | |
|
318 | ScmModel().mark_for_invalidation(repo_name) | |
|
319 | 319 | h.flash(_('Deleted repository %s') % repo_name, category='success') |
|
320 | 320 | Session().commit() |
|
321 | 321 | except AttachedForksError: |
@@ -41,8 +41,8 b' from rhodecode.lib.auth import LoginRequ' | |||
|
41 | 41 | HasReposGroupPermissionAll, HasReposGroupPermissionAny, AuthUser |
|
42 | 42 | from rhodecode.lib.base import BaseController, render |
|
43 | 43 | from rhodecode.lib.celerylib import tasks, run_task |
|
44 |
from rhodecode.lib.utils import repo2db_mapper, |
|
|
45 | set_rhodecode_config, repo_name_slug, check_git_version | |
|
44 | from rhodecode.lib.utils import repo2db_mapper, set_rhodecode_config, \ | |
|
45 | check_git_version | |
|
46 | 46 | from rhodecode.model.db import RhodeCodeUi, Repository, RepoGroup, \ |
|
47 | 47 | RhodeCodeSetting, PullRequest, PullRequestReviewers |
|
48 | 48 | from rhodecode.model.forms import UserForm, ApplicationSettingsForm, \ |
@@ -55,7 +55,6 b' from rhodecode.model.notification import' | |||
|
55 | 55 | from rhodecode.model.meta import Session |
|
56 | 56 | from rhodecode.lib.utils2 import str2bool, safe_unicode |
|
57 | 57 | from rhodecode.lib.compat import json |
|
58 | from webob.exc import HTTPForbidden | |
|
59 | 58 | log = logging.getLogger(__name__) |
|
60 | 59 | |
|
61 | 60 | |
@@ -119,7 +118,7 b' class SettingsController(BaseController)' | |||
|
119 | 118 | initial = ScmModel().repo_scan() |
|
120 | 119 | log.debug('invalidating all repositories') |
|
121 | 120 | for repo_name in initial.keys(): |
|
122 | invalidate_cache('get_repo_cached_%s' % repo_name) | |
|
121 | ScmModel().mark_for_invalidation(repo_name) | |
|
123 | 122 | |
|
124 | 123 | added, removed = repo2db_mapper(initial, rm_obsolete) |
|
125 | 124 | _repr = lambda l: ', '.join(map(safe_unicode, l)) or '-' |
@@ -21,7 +21,7 b' from rhodecode.lib.utils2 import str2boo' | |||
|
21 | 21 | safe_str, safe_int |
|
22 | 22 | from rhodecode.lib.auth import AuthUser, get_container_username, authfunc,\ |
|
23 | 23 | HasPermissionAnyMiddleware, CookieStoreWrapper |
|
24 |
from rhodecode.lib.utils import get_repo_slug |
|
|
24 | from rhodecode.lib.utils import get_repo_slug | |
|
25 | 25 | from rhodecode.model import meta |
|
26 | 26 | |
|
27 | 27 | from rhodecode.model.db import Repository, RhodeCodeUi, User, RhodeCodeSetting |
@@ -149,7 +149,7 b' class BaseVCSController(object):' | |||
|
149 | 149 | |
|
150 | 150 | :param repo_name: full repo name, also a cache key |
|
151 | 151 | """ |
|
152 | invalidate_cache('get_repo_cached_%s' % repo_name) | |
|
152 | ScmModel().mark_for_invalidation(repo_name) | |
|
153 | 153 | |
|
154 | 154 | def _check_permission(self, action, user, repo_name, ip_addr=None): |
|
155 | 155 | """ |
@@ -356,19 +356,6 b' def set_rhodecode_config(config):' | |||
|
356 | 356 | config[k] = v |
|
357 | 357 | |
|
358 | 358 | |
|
359 | def invalidate_cache(cache_key, *args): | |
|
360 | """ | |
|
361 | Puts cache invalidation task into db for | |
|
362 | further global cache invalidation | |
|
363 | """ | |
|
364 | ||
|
365 | from rhodecode.model.scm import ScmModel | |
|
366 | ||
|
367 | if cache_key.startswith('get_repo_cached_'): | |
|
368 | name = cache_key.split('get_repo_cached_')[-1] | |
|
369 | ScmModel().mark_for_invalidation(name) | |
|
370 | ||
|
371 | ||
|
372 | 359 | def map_groups(path): |
|
373 | 360 | """ |
|
374 | 361 | Given a full path to a repository, create all nested groups that this |
@@ -1,9 +1,9 b'' | |||
|
1 | 1 | from rhodecode.tests import * |
|
2 | 2 | from rhodecode.tests.fixture import Fixture |
|
3 | 3 | from rhodecode.model.db import Repository |
|
4 | from rhodecode.lib.utils import invalidate_cache | |
|
5 | 4 | from rhodecode.model.repo import RepoModel |
|
6 | 5 | from rhodecode.model.meta import Session |
|
6 | from rhodecode.model.scm import ScmModel | |
|
7 | 7 | |
|
8 | 8 | fixture = Fixture() |
|
9 | 9 | |
@@ -32,7 +32,7 b' class TestSummaryController(TestControll' | |||
|
32 | 32 | #codes stats |
|
33 | 33 | self._enable_stats() |
|
34 | 34 | |
|
35 | invalidate_cache('get_repo_cached_%s' % HG_REPO) | |
|
35 | ScmModel().mark_for_invalidation(HG_REPO) | |
|
36 | 36 | response = self.app.get(url(controller='summary', action='index', |
|
37 | 37 | repo_name=HG_REPO)) |
|
38 | 38 | response.mustcontain( |
General Comments 0
You need to be logged in to leave comments.
Login now