v0.41 Further improve FULL concurrency support, for both MySQL/MariaDB _and_ importantly, the PostGreSQL Discourse DB additions and changes with ActiveRecord connection pooling and Mutex
This commit is contained in:
		@@ -1110,17 +1110,17 @@ class GossamerForumsImporter < ImportScripts::Base
 | 
			
		||||
            # Use connection ppoling for PostgreSQL and synchronize access to shared resources
 | 
			
		||||
            ActiveRecord::Base.connection_pool.with_connection do
 | 
			
		||||
              mutex.synchronize do
 | 
			
		||||
                begin
 | 
			
		||||
#                begin
 | 
			
		||||
                  puts "Processing post ID: #{post_id}"
 | 
			
		||||
                  topic_import_job(post_id, mysql_client)  # Import topic and its replies
 | 
			
		||||
                  mark_post_as_complete(post_id)  # Mark as complete in SQLite table
 | 
			
		||||
                rescue => e
 | 
			
		||||
#                rescue => e
 | 
			
		||||
                  puts "Error processing post ID #{post_id}: #{e.message}"
 | 
			
		||||
                  mark_post_as_failed(post_id)
 | 
			
		||||
                ensure
 | 
			
		||||
 #               ensure
 | 
			
		||||
                  # Ensure the MariaDB connection is closed after processing
 | 
			
		||||
                  mysql_client.close if mysql_client
 | 
			
		||||
                end
 | 
			
		||||
#                end
 | 
			
		||||
              end
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user