mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-02-03 03:05:02 -05:00
Send timings for previous_visits to graphite.
The log statement only gives us the bad cases. This should give us a fuller picture.
This commit is contained in:
@@ -167,6 +167,9 @@ class FrontController(RedditController, OAuth2ResourceController):
|
||||
return self.abort404()
|
||||
|
||||
def _comment_visits(self, article, user, new_visit=None):
|
||||
timer = g.stats.get_timer("gold.comment_visits")
|
||||
timer.start()
|
||||
|
||||
hc_key = "comment_visits-%s-%s" % (user.name, article._id36)
|
||||
old_visits = g.hardcache.get(hc_key, [])
|
||||
|
||||
@@ -194,6 +197,8 @@ class FrontController(RedditController, OAuth2ResourceController):
|
||||
copy.pop(0)
|
||||
g.hardcache.set(hc_key, copy, 86400 * 2)
|
||||
|
||||
timer.stop()
|
||||
|
||||
return old_visits
|
||||
|
||||
|
||||
@@ -246,15 +251,7 @@ class FrontController(RedditController, OAuth2ResourceController):
|
||||
c.focal_comment = comment._id36
|
||||
elif (c.user_is_loggedin and c.user.gold and
|
||||
c.user.pref_highlight_new_comments):
|
||||
#TODO: remove this profiling if load seems okay
|
||||
from datetime import datetime
|
||||
before = datetime.now(g.tz)
|
||||
previous_visits = self._comment_visits(article, c.user, c.start_time)
|
||||
after = datetime.now(g.tz)
|
||||
delta = (after - before)
|
||||
msec = (delta.seconds * 1000 + delta.microseconds / 1000)
|
||||
if msec >= 100:
|
||||
g.log.warning("previous_visits code took %d msec" % msec)
|
||||
|
||||
# check if we just came from the submit page
|
||||
infotext = None
|
||||
|
||||
Reference in New Issue
Block a user