mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 03:30:02 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
20 lines
806 B
Ruby
20 lines
806 B
Ruby
# frozen_string_literal: true
|
|
|
|
# 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
|
|
# 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
|
|
|
|
# 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
|
|
end
|