# HG changeset patch # User RhodeCode Admin # Date 2023-05-11 10:17:28 # Node ID cc92b68cd9c33601b194a46cc396b4ba8f9d92db # Parent 5d32bc46fd992445b2f0448dcf120da817d9898c middleware: use explicit call to .includeme while importing apps and modules. This is a bit faster for code discovery and app startup diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -235,7 +235,6 @@ def error_handler(exception, request): c.causes = base_response.causes c.messages = helpers.flash.pop_messages(request=request) - exc_info = sys.exc_info() c.exception_id = id(exc_info) c.show_exception_id = isinstance(base_response, VCSServerUnavailable) \ @@ -339,32 +338,36 @@ def includeme(config, auth_resources=Non # apps if load_all: - config.include('rhodecode.api') - config.include('rhodecode.apps._base') - config.include('rhodecode.apps.hovercards') - config.include('rhodecode.apps.ops') - config.include('rhodecode.apps.channelstream') - config.include('rhodecode.apps.file_store') - config.include('rhodecode.apps.admin') - config.include('rhodecode.apps.login') - config.include('rhodecode.apps.home') - config.include('rhodecode.apps.journal') + log.debug('Starting config.include() calls') + config.include('rhodecode.api.includeme') + config.include('rhodecode.apps._base.includeme') + config.include('rhodecode.apps._base.navigation.includeme') + config.include('rhodecode.apps._base.subscribers.includeme') + config.include('rhodecode.apps.hovercards.includeme') + config.include('rhodecode.apps.ops.includeme') + config.include('rhodecode.apps.channelstream.includeme') + config.include('rhodecode.apps.file_store.includeme') + config.include('rhodecode.apps.admin.includeme') + config.include('rhodecode.apps.login.includeme') + config.include('rhodecode.apps.home.includeme') + config.include('rhodecode.apps.journal.includeme') - config.include('rhodecode.apps.repository') - config.include('rhodecode.apps.repo_group') - config.include('rhodecode.apps.user_group') - config.include('rhodecode.apps.search') - config.include('rhodecode.apps.user_profile') - config.include('rhodecode.apps.user_group_profile') - config.include('rhodecode.apps.my_account') - config.include('rhodecode.apps.gist') + config.include('rhodecode.apps.repository.includeme') + config.include('rhodecode.apps.repo_group.includeme') + config.include('rhodecode.apps.user_group.includeme') + config.include('rhodecode.apps.search.includeme') + config.include('rhodecode.apps.user_profile.includeme') + config.include('rhodecode.apps.user_group_profile.includeme') + config.include('rhodecode.apps.my_account.includeme') + config.include('rhodecode.apps.gist.includeme') - config.include('rhodecode.apps.svn_support') - config.include('rhodecode.apps.ssh_support') + config.include('rhodecode.apps.svn_support.includeme') + config.include('rhodecode.apps.ssh_support.includeme') config.include('rhodecode.apps.debug_style') if load_all: - config.include('rhodecode.integrations') + config.include('rhodecode.integrations.includeme') + config.include('rhodecode.integrations.routes.includeme') config.add_route('rhodecode_support', 'https://rhodecode.com/help/', static=True) settings['default_locale_name'] = settings.get('lang', 'en') @@ -372,6 +375,7 @@ def includeme(config, auth_resources=Non # Add subscribers. if load_all: + log.debug('Adding subscribers....') config.add_subscriber(scan_repositories_if_enabled, pyramid.events.ApplicationCreated) config.add_subscriber(write_metadata_if_needed, @@ -398,6 +402,7 @@ def includeme(config, auth_resources=Non # include RhodeCode plugins includes = aslist(settings.get('rhodecode.includes', [])) + log.debug('processing rhodecode.includes data...') for inc in includes: config.include(inc)