Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Templated: Remove timer for g.timed_templates
Browse files Browse the repository at this point in the history
These timings were never published and sort of are duplicates of the
"render.RENDER_CLASS_NAME.cached" timer in Templated._render.
  • Loading branch information
bsimpson63 committed Sep 21, 2016
1 parent 7eb3ab2 commit 5c43a83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
2 changes: 0 additions & 2 deletions r2/example.ini
Expand Up @@ -230,8 +230,6 @@ uncompressedJS = true
sqlprinting = false
# directory to write cProfile stats dumps to (disabled if not set)
profile_directory =
# template names to record render timings for
timed_templates = Reddit, Link, Comment, LinkListing, NestedListing, SubredditTopBar


############################################ PLUGINS
Expand Down
1 change: 0 additions & 1 deletion r2/r2/lib/app_globals.py
Expand Up @@ -280,7 +280,6 @@ class Globals(object):
'offsite_subdomains',
'TRAFFIC_LOG_HOSTS',
'exempt_login_user_agents',
'timed_templates',
'autoexpand_media_types',
'multi_icons',
'hide_subscribers_srs',
Expand Down
22 changes: 5 additions & 17 deletions r2/r2/lib/wrapped.pyx
Expand Up @@ -189,31 +189,19 @@ class Templated(object):
"""
from filters import unsafe
from pylons import tmpl_context as c
from pylons import app_globals as g

if self.render_class_name in g.timed_templates:
timer = g.stats.get_timer('render.%s.nocache' %
self.render_class_name,
publish=False)
timer.start()
else:
timer = None

# the style has to default to the global render style
# fetch template
template = self.template(style)
if timer: timer.intermediate('template')
# store the global render style (since child templates)

# store the global render style (child templates might override it)
render_style = c.render_style
c.render_style = style
# render the template
res = template.render(thing = self)
if timer: timer.intermediate('render')

res = template.render(thing=self)
if not isinstance(res, StringTemplate):
res = StringTemplate(res)

# reset the global render style
c.render_style = render_style
if timer: timer.stop()
return res

def _render(self, style, **kwargs):
Expand Down

0 comments on commit 5c43a83

Please sign in to comment.