middleware: use timing for complete stack call

This commit is contained in:
RhodeCode Admin 2023-03-27 21:45:38 +02:00
parent f7db8ef833
commit 42e4d2d45b

View file

@ -367,8 +367,8 @@ def includeme(config, auth_resources=None):
config.include('rhodecode.integrations')
config.add_route('rhodecode_support', 'https://rhodecode.com/help/', static=True)
config.add_translation_dirs('rhodecode:i18n/')
settings['default_locale_name'] = settings.get('lang', 'en')
config.add_translation_dirs('rhodecode:i18n/')
# Add subscribers.
if load_all:
@ -433,6 +433,7 @@ def wrap_app_in_wsgi_middlewares(pyramid_app, config):
# this should be the outer most middleware in the wsgi stack since
# middleware like Routes make database calls
def pyramid_app_with_cleanup(environ, start_response):
start = time.time()
try:
return pyramid_app(environ, start_response)
finally:
@ -445,7 +446,8 @@ def wrap_app_in_wsgi_middlewares(pyramid_app, config):
# if not, then something, somewhere is leaving a connection open
pool = meta.Base.metadata.bind.engine.pool
log.debug('sa pool status: %s', pool.status())
log.debug('Request processing finalized')
total = time.time() - start
log.debug('Request processing finalized: %.4fs', total)
return pyramid_app_with_cleanup