WORKAROUND: Can't reinsert a deleted middleware.

This commit is contained in:
Guo Xiang Tan 2017-09-04 20:42:22 +08:00
parent 3840c50083
commit 475e86d59e
1 changed files with 7 additions and 2 deletions

View File

@ -1,8 +1,13 @@
# 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
Rails.configuration.middleware.delete MessageBus::Rack::Middleware
Rails.configuration.middleware.unshift MessageBus::Rack::Middleware
# 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)