diff --git a/Gemfile b/Gemfile index 92aeefd9503..ef02bd1b50e 100644 --- a/Gemfile +++ b/Gemfile @@ -112,8 +112,12 @@ gem 'fast_blank' #, github: "SamSaffron/fast_blank" # IMPORTANT: mini profiler monkey patches, so it better be required last # If you want to amend mini profiler to do the monkey patches in the railstie -# we are open to it. -gem 'rack-mini-profiler' #, git: 'git://github.com/SamSaffron/MiniProfiler' +# we are open to it. by deferring require to the initializer we can configure disourse installs without it +gem 'rack-mini-profiler', require: false # require: false #, git: 'git://github.com/SamSaffron/MiniProfiler' + +# used for caching, optional +gem 'redis-rack-cache', require: false +gem 'rack-cache', require: false # perftools only works on 1.9 atm group :profile do diff --git a/Gemfile.lock b/Gemfile.lock index b9a7c112757..340090ab075 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -319,7 +319,7 @@ GEM rack (1.4.5) rack-cache (1.2) rack (>= 0.4) - rack-mini-profiler (0.1.25) + rack-mini-profiler (0.1.26) rack (>= 1.1.3) rack-openid (1.3.1) rack (>= 1.1.0) @@ -367,6 +367,9 @@ GEM redis-rack (1.4.2) rack (~> 1.4.1) redis-store (~> 1.1.0) + redis-rack-cache (1.2.1) + rack-cache (~> 1.2) + redis-store (~> 1.1.0) redis-rails (3.2.3) redis-actionpack (~> 3.2.3) redis-activesupport (~> 3.2.3) @@ -514,6 +517,7 @@ DEPENDENCIES openid-redis-store pg pry-rails + rack-cache rack-mini-profiler rails rails_multisite! @@ -522,6 +526,7 @@ DEPENDENCIES rb-inotify (~> 0.8.8) redcarpet redis + redis-rack-cache redis-rails rest-client rinku diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0b423b527d4..e0e744af2a0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -140,7 +140,7 @@ class ApplicationController < ActionController::Base def can_cache_content? # Don't cache unless we're in production mode - return false unless Rails.env.production? + return false unless Rails.env.production? || Rails.env == "profile" # Don't cache logged in users return false if current_user.present? diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index ca98cbf72d5..1c6a62c0e85 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -6,6 +6,7 @@ class CategoriesController < ApplicationController def index list = CategoryList.new(current_user) + discourse_expires_in 1.minute render_serialized(list, CategoryListSerializer) end diff --git a/app/views/common/_discourse_javascript.html.erb b/app/views/common/_discourse_javascript.html.erb index c0c6ead0c4d..72b8f05d4ca 100644 --- a/app/views/common/_discourse_javascript.html.erb +++ b/app/views/common/_discourse_javascript.html.erb @@ -16,21 +16,11 @@ <%# load the selected locale before any other scripts %> <%= javascript_include_tag "locales/#{I18n.locale}" %> - -<%- if mini_profiler_enabled? %> - <%- Rack::MiniProfiler.step "application" do %> - <%= javascript_include_tag "application" %> - <%-end%> - - <%- Rack::MiniProfiler.step "admin" do %> - <%= javascript_include_tag "admin"%> - <%-end%> -<%- else %> - <%= javascript_include_tag "application" %> - <%- if admin? %> - <%= javascript_include_tag "admin"%> - <%- end %> -<%- end%> +<%= javascript_include_tag "application" %> +<%= javascript_include_tag "admin"%> +<%- if admin? %> + <%= javascript_include_tag "admin"%> +<%- end %>