FIX: Create and consume temp table inside a transaction (#7030)

To prevent access issue in pgbouncer which runs in transaction pooling
This commit is contained in:
Vinoth Kannan 2019-02-20 08:22:40 +05:30 committed by Sam
parent 1f4ace4f56
commit da1ff2da2c

View File

@ -34,6 +34,7 @@ class S3Inventory
download_inventory_files_to_tmp_directory download_inventory_files_to_tmp_directory
decompress_inventory_files decompress_inventory_files
ActiveRecord::Base.transaction do
begin begin
table_name = "#{inventory_id}_inventory" table_name = "#{inventory_id}_inventory"
connection = ActiveRecord::Base.connection.raw_connection connection = ActiveRecord::Base.connection.raw_connection
@ -68,6 +69,7 @@ class S3Inventory
end end
end end
end end
end
def download_inventory_files_to_tmp_directory def download_inventory_files_to_tmp_directory
files.each do |file| files.each do |file|