DEV: Disable better_errors when developing with more than one worker (#8201)

From the better_errors README:

> Better Errors works by leaving a lot of context in server process memory. If you're using a web server that runs multiple "workers" it's likely that a second request (as happens when you click on a stack frame) will hit a different worker. That worker won't have the necessary context in memory, and you'll see a Session Expired message.
This commit is contained in:
David Taylor 2019-10-16 14:44:48 +01:00 committed by GitHub
parent 02250bd91f
commit 1b8be069e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,11 @@ Discourse::Application.configure do
BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP'] if ENV['TRUSTED_IP']
if defined?(Unicorn) && ENV["UNICORN_WORKERS"].to_i != 1
# BetterErrors doesn't work with multiple unicorn workers. Disable it to avoid confusion
Rails.configuration.middleware.delete BetterErrors::Middleware
end
config.load_mini_profiler = true
if hosts = ENV['DISCOURSE_DEV_HOSTS']
config.hosts.concat(hosts.split(","))