v0.42.1 Rewrite and simplication of concurrent-ruby support

This commit is contained in:
David Sainty 2024-08-18 02:01:31 +10:00
parent 7b3a9babcb
commit 416dc9c1e0

View File

@ -1093,6 +1093,7 @@ class GossamerForumsImporter < ImportScripts::Base
# Run until all posts have been processed. # Run until all posts have been processed.
until is_complete until is_complete
puts "QQ 11 -- GETTING NEXT BATCH ****************************************"
#### # Query in batches, create pool, wait for termination, do it again #### # Query in batches, create pool, wait for termination, do it again
#### current_post_batch_max = current_post_batch + batch_size #### current_post_batch_max = current_post_batch + batch_size
@ -1103,6 +1104,7 @@ class GossamerForumsImporter < ImportScripts::Base
# Process each post in the current batch # Process each post in the current batch
current_post_batch.each do |post_id| current_post_batch.each do |post_id|
puts "QQ 22 -- #{post_id}"
####### # Static pool size based on number of CPUs ####### # Static pool size based on number of CPUs
@ -1158,6 +1160,8 @@ class GossamerForumsImporter < ImportScripts::Base
end end
ensure ensure
# Ensure the MariaDB connection is closed after processing # Ensure the MariaDB connection is closed after processing
mysql_client.close if mysql_client
puts "** CLOSED MariaDB client"
puts "PP 22 -- #{post_id}" puts "PP 22 -- #{post_id}"
puts " FINAL Checking MySQL connection status..." puts " FINAL Checking MySQL connection status..."
if mysql_client.query('SELECT 1').nil? if mysql_client.query('SELECT 1').nil?
@ -1165,8 +1169,6 @@ class GossamerForumsImporter < ImportScripts::Base
else else
puts " MySQL connection is valid" puts " MySQL connection is valid"
end end
mysql_client.close if mysql_client
puts "** CLOSED MariaDB client"
end end
end end
end end