##// END OF EJS Templates
app: improve logging, and remove DB calls on app startup.
milka -
r4548:2f66e04c default
parent child Browse files
Show More
@@ -36,7 +36,7 b' from rhodecode.authentication.plugins im'
36 36 from rhodecode.events import trigger
37 37 from rhodecode.model.db import true, UserNotice
38 38
39 from rhodecode.lib import audit_logger, rc_cache
39 from rhodecode.lib import audit_logger, rc_cache, auth
40 40 from rhodecode.lib.exceptions import (
41 41 UserCreationError, UserOwnsReposException, UserOwnsRepoGroupsException,
42 42 UserOwnsUserGroupsException, UserOwnsPullRequestsException,
@@ -295,6 +295,10 b' class UsersView(UserAppView):'
295 295 c.allowed_extern_types = [
296 296 (x.uid, x.get_display_name()) for x in self.get_auth_plugins()
297 297 ]
298 perms = req.registry.settings.get('available_permissions')
299 if not perms:
300 # inject info about available permissions
301 auth.set_available_permissions(req.registry.settings)
298 302
299 303 c.available_permissions = req.registry.settings['available_permissions']
300 304 PermissionModel().set_global_permission_choices(
@@ -53,7 +53,7 b' from rhodecode.lib.utils2 import aslist '
53 53 from rhodecode.lib.exc_tracking import store_exception
54 54 from rhodecode.subscribers import (
55 55 scan_repositories_if_enabled, write_js_routes_if_enabled,
56 write_metadata_if_needed, write_usage_data, inject_app_settings)
56 write_metadata_if_needed, write_usage_data)
57 57
58 58
59 59 log = logging.getLogger(__name__)
@@ -310,8 +310,6 b' def includeme(config):'
310 310
311 311 # Add subscribers.
312 312 if load_all:
313 config.add_subscriber(inject_app_settings,
314 pyramid.events.ApplicationCreated)
315 313 config.add_subscriber(scan_repositories_if_enabled,
316 314 pyramid.events.ApplicationCreated)
317 315 config.add_subscriber(write_metadata_if_needed,
@@ -74,7 +74,11 b' def configure_dogpile_cache(settings):'
74 74
75 75 new_region.configure_from_config(settings, 'rc_cache.{}.'.format(region_name))
76 76 new_region.function_key_generator = backend_key_generator(new_region.actual_backend)
77 log.debug('dogpile: registering a new region %s[%s]', region_name, new_region.__dict__)
77 if log.isEnabledFor(logging.DEBUG):
78 region_args = dict(backend=new_region.actual_backend.__class__,
79 region_invalidator=new_region.region_invalidator.__class__)
80 log.debug('dogpile: registering a new region `%s` %s', region_name, region_args)
81
78 82 region_meta.dogpile_cache_regions[region_name] = new_region
79 83
80 84
@@ -104,12 +104,6 b' def add_request_user_context(event):'
104 104 request.environ['rc_req_id'] = req_id
105 105
106 106
107 def inject_app_settings(event):
108 settings = event.app.registry.settings
109 # inject info about available permissions
110 auth.set_available_permissions(settings)
111
112
113 107 def scan_repositories_if_enabled(event):
114 108 """
115 109 This is subscribed to the `pyramid.events.ApplicationCreated` event. It
General Comments 0
You need to be logged in to leave comments. Login now