Connection should close if there was an error executing the query
leoskyrocker opened this issue · 0 comments
leoskyrocker commented
Describe the bug
Currently, we're only closing the connection after executing a query if the keep_connected
flag is set to false. However, if there is a connection error while executing the query, the query-exporter won't be able to re-use a connection subsequently, and hence it will continue to error out if keep_connected
is configured to true.
Closing the connection is expected after after the query execution if there has been an exception.
A simple fix is to close the connection in the exception block (any exceptions).
A more proper fix is to close the connection if the exception is related to a connection error.