mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 15:52:45 +08:00
c30aeafd9d
Why this change? We have been debugging flaky system tests and noticed in https://github.com/discourse/discourse/actions/runs/7911902047/job/21596791343?pr=25690 that ActiveRecord connection checkout timeouts are encountered because the Capybara server thread is processing requests even after `Capybara.reset_session!` and ActiveRecord's `teardown_fixtures` have already been call. The theory here is that an inflight request can still hit the Capybara server even after `Capybara.reset_session!` has been called and end up eating up an ActiveRecord connection for too long and also messing with the database outside of a transaction. What does this change do? This change adds a `BlockRequestsMiddleware` middleware in the test environment which is enabled to reject all incoming requests at the end of each system test and before `Capybara.reset_session!` is called. At the start of each RSpec test, the middleware is disabled again. |
||
---|---|---|
.. | ||
cloud/cloud66 | ||
environments | ||
initializers | ||
locales | ||
application.rb | ||
boot.rb | ||
cdn.yml.sample | ||
database.yml | ||
deploy.rb.sample | ||
dev_defaults.yml | ||
discourse_defaults.conf | ||
discourse.config.sample | ||
discourse.pill.sample | ||
environment.rb | ||
logrotate.conf | ||
multisite.yml.production-sample | ||
nginx.global.conf | ||
nginx.sample.conf | ||
projections.json | ||
puma.rb | ||
routes.rb | ||
sidekiq.yml | ||
site_settings.yml | ||
spring.rb | ||
thin.yml.sample | ||
unicorn_launcher | ||
unicorn_upstart.conf | ||
unicorn.conf.rb |