Reset PG connection if connection status is bad

This commit is contained in:
navaneeth 2021-06-01 13:27:13 +05:30
parent ccadcb2e9d
commit 58f2375f75

View file

@ -39,7 +39,10 @@ class PostgresqlQueryService
result = connection.exec(query_text)
rescue StandardError => e
reset_connection(data_source) if connection&.finished?
if connection&.status === PG::Constants::CONNECTION_BAD
connection&.finish
reset_connection(data_source)
end
puts e
error = { message: e.message }