#NEWLINE# def _connect_ping_listener( connection , branch ) : #NEWLINE# #INDENT# 'Ping the server at connection startup.\n\n    Ping the server at transaction begin and transparently reconnect\n    if a disconnect exception occurs.\n    ' #NEWLINE# if branch : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# save_should_close_with_result = connection . should_close_with_result #NEWLINE# connection . should_close_with_result = False #NEWLINE# try : #NEWLINE# #INDENT# connection . scalar ( select ( [ 1 ] ) ) #NEWLINE# #UNINDENT# except exception . DBConnectionError : #NEWLINE# #INDENT# connection . scalar ( select ( [ 1 ] ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# connection . should_close_with_result = save_should_close_with_result