From 2efdb437fa1daa2dfc5a02aca0724796c22b3683 Mon Sep 17 00:00:00 2001 From: Keith Mitchell Date: Thu, 15 Nov 2012 10:01:48 -0800 Subject: [PATCH] promote.py: Clearer timer names Also, replace Timer with log message for infrequently hit code path. --- r2/r2/lib/promote.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/r2/r2/lib/promote.py b/r2/r2/lib/promote.py index 87e0129f6..b882025cc 100644 --- a/r2/r2/lib/promote.py +++ b/r2/r2/lib/promote.py @@ -691,7 +691,7 @@ def promotion_key(): return "current_promotions:1" def get_live_promotions(srids): - timer = g.stats.get_timer("promote.get_live.cass") + timer = g.stats.get_timer("promote.get_live") timer.start() weights = LiveAdWeights.get(srids) timer.stop() @@ -699,9 +699,7 @@ def get_live_promotions(srids): def set_live_promotions(weights): - timer = g.stats.get_timer("promote.set_live.cass") - timer.start() - + start = time.time() # First, figure out which subreddits have had ads recently today = promo_datetime_now() yesterday = today - timedelta(days=1) @@ -718,7 +716,9 @@ def set_live_promotions(weights): all_weights[LiveAdWeights.FRONT_PAGE] = all_weights.pop('') LiveAdWeights.set_all_from_weights(all_weights) - timer.stop() + end = time.time() + g.log.info("promote.set_live_promotions completed in %s seconds", + end - start) # Gotcha: even if links are scheduled and authorized, they won't be added to # current promotions until they're actually charged, so make sure to call