Skip to content

A platform for community discussion. Free, open, simple.

DEV: Raise an error if thread doesn't return within expected time.

Guo Xiang Tan81b99efc681c
diff --git a/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb b/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb
index a5085b6c813..80d0cce5bd7 100644
--- a/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb
+++ b/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb
@@ -40,9 +40,12 @@ describe ActiveRecord::ConnectionHandling do
postgresql_fallback_handler.setup!
Discourse.disable_readonly_mode(Discourse::PG_READONLY_MODE_KEY)
ActiveRecord::Base.unstub(:postgresql_connection)
- ActiveRecord::Base.establish_connection
- (Thread.list - @threads).each { |thread| thread.join(5) }
+ (Thread.list - @threads).each do |thread|
+ raise "Thread still running" unless thread.join(5)
+ end
+
+ ActiveRecord::Base.establish_connection
end
describe "#postgresql_fallback_connection" do