A platform for community discussion. Free, open, simple.
DEV: Fix connections timeout in system test (#25835)
Alan Guo Xiang Tanad0824b7e3a2
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex f2d18c2cf4f..22c4ed07369 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -254,7 +254,6 @@ jobs:if: matrix.build_type == 'system' && matrix.target == 'chat'env:CHECKOUT_TIMEOUT: 10- DEBUG_AR_CONNECTION_QUEUE: 1run: LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --use-runtime-info --profile=50 --verbose --format documentation plugins/chat/spec/systemtimeout-minutes: 30diff --git a/config/initializers/200-first_middlewares.rb b/config/initializers/200-first_middlewares.rbindex ed3e2dccf2a..a8390498cd8 100644--- a/config/initializers/200-first_middlewares.rb+++ b/config/initializers/200-first_middlewares.rb@@ -54,15 +54,14 @@ if Rails.env.test?def call(env)request = Rack::Request.new(env)- if request.xhr? &&- (- @@block_requests ||- (- self.class.current_example_location.present? &&- self.class.current_example_location !=- request.cookies[RSPEC_CURRENT_EXAMPLE_COOKIE_STRING]- )- )+ if (+ @@block_requests ||+ (+ request.xhr? && self.class.current_example_location.present? &&+ self.class.current_example_location !=+ request.cookies[RSPEC_CURRENT_EXAMPLE_COOKIE_STRING]+ )+ )[503,{ "Content-Type" => "text/plain" },diff --git a/lib/freedom_patches/debug_connection_queue.rb b/lib/freedom_patches/debug_connection_queue.rbdeleted file mode 100644index fd70e6bcd83..00000000000--- a/lib/freedom_patches/debug_connection_queue.rb+++ /dev/null@@ -1,40 +0,0 @@-# frozen_string_literal: true--if ENV["DEBUG_AR_CONNECTION_QUEUE"] == "1"- module QueuePatch- # Add +element+ to the queue. Never blocks.- def add(element)- puts "::group::##{Process.pid} Adding element to the queue"- puts Thread.current.backtrace.first(30).join("\n")- puts "::endgroup::"- super- end-- # If +element+ is in the queue, remove and return it, or +nil+.- def delete(element)- puts "::group::##{Process.pid} Delete element from the queue"- puts Thread.current.backtrace.first(30).join("\n")- puts "::endgroup::"- super- end-- # Remove all elements from the queue.- def clear- puts "::group::##{Process.pid} Clear all elements from the queue"- puts Thread.current.backtrace.first(30).join("\n")- puts "::endgroup::"- super- end-- private-- def remove- puts "::group::##{Process.pid} Removing element from the queue"- puts Thread.current.backtrace.first(30).join("\n")- puts "::endgroup::"- super- end- end-- ActiveRecord::ConnectionAdapters::ConnectionPool::Queue.prepend(QueuePatch)-end