From bd522e5af784becef92dab461d6b91d116a73ec0 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Fri, 22 Feb 2013 11:49:33 -0800 Subject: [PATCH] Comment Votes: update CommentSortsCache *after* updating comment scores. This was causing CSC to have scores based on stale (off-by-one) vote data. One thousand thanks to @raldi for noticing this. --- r2/r2/lib/db/queries.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/r2/r2/lib/db/queries.py b/r2/r2/lib/db/queries.py index 6a13dfdc4..d75240eea 100755 --- a/r2/r2/lib/db/queries.py +++ b/r2/r2/lib/db/queries.py @@ -1507,10 +1507,6 @@ def process_votes(qname, limit=0): votee = Thing._by_fullname(tid, data = True) timer.intermediate("preamble") - if isinstance(votee, Comment): - update_comment_votes([votee]) - timer.intermediate("update_comment_votes") - # I don't know how, but somebody is sneaking in votes # for subreddits if isinstance(votee, (Link, Comment)): @@ -1518,6 +1514,10 @@ def process_votes(qname, limit=0): handle_vote(voter, votee, dir, ip, organic, cheater = cheater, foreground=True, timer=timer) + if isinstance(votee, Comment): + update_comment_votes([votee]) + timer.intermediate("update_comment_votes") + timer.flush() amqp.consume_items(qname, _handle_vote, verbose = False)