v0.42.1 Rewrite and simplication of concurrent-ruby support

This commit is contained in:
David Sainty 2024-08-18 01:44:29 +10:00
parent 23a65c5f5c
commit 7b3a9babcb

View File

@ -1131,7 +1131,12 @@ class GossamerForumsImporter < ImportScripts::Base
database: "slowtwitch"
)
puts "PP 22 -- #{post_id}"
puts " FIRST Checking MySQL connection status..."
if mysql_client.query('SELECT 1').nil?
puts " MySQL connection is not valid"
else
puts " MySQL connection is valid"
end
begin
# Use connection pooling for PostgreSQL and synchronize access to shared resources
ActiveRecord::Base.connection_pool.with_connection do
@ -1153,7 +1158,15 @@ class GossamerForumsImporter < ImportScripts::Base
end
ensure
# Ensure the MariaDB connection is closed after processing
puts "PP 22 -- #{post_id}"
puts " FINAL Checking MySQL connection status..."
if mysql_client.query('SELECT 1').nil?
puts " MySQL connection is not valid"
else
puts " MySQL connection is valid"
end
mysql_client.close if mysql_client
puts "** CLOSED MariaDB client"
end
end
end