mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 01:18:23 +00:00
Reset pg connection if connection is closed
This commit is contained in:
parent
bd470f7d01
commit
1b60093904
2 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue