Skip to content
Snippets Groups Projects
Commit 34f85e69 authored by ArtOfCode-'s avatar ArtOfCode-
Browse files

Correct hot questions

parent c6c20b59
No related branches found
No related tags found
No related merge requests found
......@@ -105,12 +105,14 @@ class ApplicationController < ActionController::Base
end
def pull_hot_questions
@hot_questions = Rails.cache.fetch('hot_questions', expires_in: 4.hours) do
Post.undeleted.where(updated_at: (Rails.env.development? ? 365 : 7).days.ago..Time.now)
@hot_questions = Rails.cache.fetch("#{RequestContext.community_id}/hot_questions", expires_in: 4.hours) do
Rack::MiniProfiler.step 'hot_questions: cache miss' do
Post.undeleted.where(last_activity: (Rails.env.development? ? 365 : 7).days.ago..Time.now)
.where(post_type_id: Question.post_type_id).includes(:category)
.order('score DESC').limit(SiteSetting['HotQuestionsCount'])
end
end
end
def pull_categories
@header_categories = Rails.cache.fetch("#{RequestContext.community_id}/header_categories") do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment