2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-12-08 18:48:41 -06:00
|
|
|
# we want MesageBus in the absolute front
|
|
|
|
# this is important cause the vast majority of web requests go to it
|
|
|
|
# this allows us to avoid full middleware crawls each time
|
2017-09-04 07:42:22 -05:00
|
|
|
# Pending https://github.com/rails/rails/pull/27936
|
|
|
|
session_operations = Rails::Configuration::MiddlewareStackProxy.new([
|
|
|
|
[:delete, MessageBus::Rack::Middleware],
|
|
|
|
[:unshift, MessageBus::Rack::Middleware],
|
|
|
|
])
|
|
|
|
|
|
|
|
Rails.configuration.middleware = Rails.configuration.middleware + session_operations
|
2015-12-08 18:48:41 -06:00
|
|
|
|
|
|
|
# no reason to track this in development, that is 300+ redis calls saved per
|
|
|
|
# page view (we serve all assets out of thin in development)
|
|
|
|
if Rails.env != 'development' || ENV['TRACK_REQUESTS']
|
|
|
|
require 'middleware/request_tracker'
|
|
|
|
Rails.configuration.middleware.unshift Middleware::RequestTracker
|
2019-06-05 01:08:11 -05:00
|
|
|
|
|
|
|
if GlobalSetting.enable_performance_http_headers
|
|
|
|
MethodProfiler.ensure_discourse_instrumentation!
|
|
|
|
end
|
2015-12-08 18:48:41 -06:00
|
|
|
end
|