From 9e47bb6db7018fbee0f0aaa942d897e2d8c23628 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Fri, 25 May 2012 10:55:21 -0700 Subject: [PATCH] Dual-write last modified for user page listings. --- r2/r2/lib/db/queries.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/r2/r2/lib/db/queries.py b/r2/r2/lib/db/queries.py index 88bc0ad65..283c98f90 100755 --- a/r2/r2/lib/db/queries.py +++ b/r2/r2/lib/db/queries.py @@ -1226,32 +1226,37 @@ def handle_vote(user, thing, dir, ip, organic, cheater=False, foreground=False): g.log.error("duplicate vote for: %s" % str((user, thing, dir))) return + timestamps = [] if isinstance(thing, Link): new_vote(v, foreground=foreground) #update the modified flags if user._id == thing.author_id: - set_last_modified(user, 'overview') - set_last_modified(user, 'submitted') + timestamps.append('Overview') + timestamps.append('Submitted') #update sup listings sup.add_update(user, 'submitted') #update sup listings if dir: - set_last_modified(user, 'liked') + timestamps.append('Liked') sup.add_update(user, 'liked') elif dir is False: - set_last_modified(user, 'disliked') + timestamps.append('Disliked') sup.add_update(user, 'disliked') elif isinstance(thing, Comment): #update last modified if user._id == thing.author_id: - set_last_modified(user, 'overview') - set_last_modified(user, 'commented') + timestamps.append('Overview') + timestamps.append('Commented') #update sup listings sup.add_update(user, 'commented') + for timestamp in timestamps: + set_last_modified(user, timestamp.lower()) + LastModified.touch(user._fullname, timestamps) + def process_votes_single(qname, limit=0): # limit is taken but ignored for backwards compatibility