# HG changeset patch # User Marcin Kuzminski # Date 2018-05-23 11:15:25 # Node ID f4490348bedb4e230d327aaaf1e0fa87581f341a # Parent 1ad97a6b870437c0f20afb71d5790e653b7462d0 sqlalchemy: allow ping connection using dedicated flag for sqlachemy. - this is usefull flag but we don't need it to be connected to debug flag. diff --git a/rhodecode/lib/utils2.py b/rhodecode/lib/utils2.py --- a/rhodecode/lib/utils2.py +++ b/rhodecode/lib/utils2.py @@ -360,6 +360,10 @@ def engine_from_config(configuration, pr normal = '\x1b[0m' return ''.join([color_seq, sql, normal]) + _ping_connection = configuration.get('sqlalchemy.db1.ping_connection') + if configuration['debug'] or _ping_connection: + sqlalchemy.event.listen(engine, "engine_connect", ping_connection) + if configuration['debug']: # attach events only for debug configuration @@ -381,8 +385,6 @@ def engine_from_config(configuration, pr parameters, context, executemany): delattr(conn, 'query_start_time') - sqlalchemy.event.listen(engine, "engine_connect", - ping_connection) sqlalchemy.event.listen(engine, "before_cursor_execute", before_cursor_execute) sqlalchemy.event.listen(engine, "after_cursor_execute",