Reset pg connection if connection is closed

This commit is contained in:
navaneeth 2021-05-23 23:00:26 +05:30
parent bd470f7d01
commit 1b60093904
2 changed files with 6 additions and 0 deletions

View file

@ -18,5 +18,9 @@ module DatasourceUtils
$connections[data_source.id] = { connection: connection, updated_at: data_source.updated_at }
end
def reset_connection(data_source)
$connections.delete @data_source.id
end
end

View file

@ -39,6 +39,8 @@ class PostgresqlQueryService
result = connection.exec(query_text)
rescue StandardError => e
reset_connection(data_source) if connection.finished?
puts e
error = { message: e.message }
end