PERF: Rendering crawler's template is expensive.
This commit is contained in:
parent
3d4cdd7040
commit
4e7e4cee7d
|
@ -9,8 +9,6 @@ class AboutController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
# @list = list
|
|
||||||
# store_preloaded(list.preload_key, MultiJson.dump(TopicListSerializer.new(list, scope: guardian)))
|
|
||||||
render :index
|
render :index
|
||||||
end
|
end
|
||||||
format.json do
|
format.json do
|
||||||
|
|
|
@ -169,8 +169,12 @@ module ApplicationHelper
|
||||||
MobileDetection.resolve_mobile_view!(request.user_agent,params,session)
|
MobileDetection.resolve_mobile_view!(request.user_agent,params,session)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def crawler_layout?
|
||||||
|
controller.try(:use_crawler_layout?)
|
||||||
|
end
|
||||||
|
|
||||||
def include_crawler_content?
|
def include_crawler_content?
|
||||||
controller.try(:use_crawler_layout?) || !mobile_view?
|
crawler_layout? || !mobile_view?
|
||||||
end
|
end
|
||||||
|
|
||||||
def mobile_device?
|
def mobile_device?
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
<% if crawler_layout? %>
|
||||||
|
|
||||||
<% content_for :title do %><%=t "about" %><% end %>
|
<% content_for :title do %><%=t "about" %><% end %>
|
||||||
|
|
||||||
<section itemscope itemtype="https://schema.org/AboutPage">
|
<section itemscope itemtype="https://schema.org/AboutPage">
|
||||||
|
@ -52,6 +54,8 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%- stats = About.fetch_cached_stats %>
|
||||||
|
|
||||||
<section class='about stats'>
|
<section class='about stats'>
|
||||||
<h2><%=t 'js.about.stats' %></h2>
|
<h2><%=t 'js.about.stats' %></h2>
|
||||||
|
|
||||||
|
@ -64,37 +68,39 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='title'><%=t 'js.about.topic_count' %></td>
|
<td class='title'><%=t 'js.about.topic_count' %></td>
|
||||||
<td><%= @about.stats[:topic_count] %></td>
|
<td><%= stats["topic_count"] %></td>
|
||||||
<td><%= @about.stats[:topics_7_days] %></td>
|
<td><%= stats["topics_7_days"] %></td>
|
||||||
<td><%= @about.stats[:topics_30_days] %></td>
|
<td><%= stats["topics_30_days"] %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%=t 'js.about.post_count' %></td>
|
<td><%=t 'js.about.post_count' %></td>
|
||||||
<td><%= @about.stats[:post_count] %></td>
|
<td><%= stats["post_count"] %></td>
|
||||||
<td><%= @about.stats[:posts_7_days] %></td>
|
<td><%= stats["posts_7_days"] %></td>
|
||||||
<td><%= @about.stats[:posts_30_days] %></td>
|
<td><%= stats["posts_30_days"] %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%=t 'js.about.user_count' %></td>
|
<td><%=t 'js.about.user_count' %></td>
|
||||||
<td><%= @about.stats[:user_count] %></td>
|
<td><%= stats["user_count"] %></td>
|
||||||
<td><%= @about.stats[:users_7_days] %></td>
|
<td><%= stats["users_7_days"] %></td>
|
||||||
<td><%= @about.stats[:users_30_days] %></td>
|
<td><%= stats["users_30_days"] %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%=t 'js.about.active_user_count' %></td>
|
<td><%=t 'js.about.active_user_count' %></td>
|
||||||
<td>—</td>
|
<td>—</td>
|
||||||
<td><%= @about.stats[:active_users_7_days] %></td>
|
<td><%= stats["active_users_7_days"] %></td>
|
||||||
<td><%= @about.stats[:active_users_30_days] %></td>
|
<td><%= stats["active_users_30_days"] %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%=t 'js.about.like_count' %></td>
|
<td><%=t 'js.about.like_count' %></td>
|
||||||
<td><%= @about.stats[:like_count] %></td>
|
<td><%= stats["like_count"] %></td>
|
||||||
<td><%= @about.stats[:likes_7_days] %></td>
|
<td><%= stats["likes_7_days"] %></td>
|
||||||
<td><%= @about.stats[:likes_30_days] %></td>
|
<td><%= stats["likes_30_days"] %></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue