mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
DEV: Fix connections timeout in system test (#25835)
Why this change? This regressed in6e9fbb5bab
because we had a `request.xhr?` check before we decide to block requests. However, there could not none-xhr requests which we need to block as well at the end of each system test when `@@block_requests` is true. This also reverts commit6437f27f90
.
This commit is contained in:
parent
cd6fd515fe
commit
ad0824b7e3
1
.github/workflows/tests.yml
vendored
1
.github/workflows/tests.yml
vendored
|
@ -254,7 +254,6 @@ jobs:
|
||||||
if: matrix.build_type == 'system' && matrix.target == 'chat'
|
if: matrix.build_type == 'system' && matrix.target == 'chat'
|
||||||
env:
|
env:
|
||||||
CHECKOUT_TIMEOUT: 10
|
CHECKOUT_TIMEOUT: 10
|
||||||
DEBUG_AR_CONNECTION_QUEUE: 1
|
|
||||||
run: 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/system
|
run: 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/system
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
|
||||||
|
|
|
@ -54,15 +54,14 @@ if Rails.env.test?
|
||||||
def call(env)
|
def call(env)
|
||||||
request = Rack::Request.new(env)
|
request = Rack::Request.new(env)
|
||||||
|
|
||||||
if request.xhr? &&
|
if (
|
||||||
(
|
@@block_requests ||
|
||||||
@@block_requests ||
|
(
|
||||||
(
|
request.xhr? && self.class.current_example_location.present? &&
|
||||||
self.class.current_example_location.present? &&
|
self.class.current_example_location !=
|
||||||
self.class.current_example_location !=
|
request.cookies[RSPEC_CURRENT_EXAMPLE_COOKIE_STRING]
|
||||||
request.cookies[RSPEC_CURRENT_EXAMPLE_COOKIE_STRING]
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
[
|
[
|
||||||
503,
|
503,
|
||||||
{ "Content-Type" => "text/plain" },
|
{ "Content-Type" => "text/plain" },
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user