diff --git a/r2/r2/lib/db/queries.py b/r2/r2/lib/db/queries.py index 283c98f90..b3a4d107e 100755 --- a/r2/r2/lib/db/queries.py +++ b/r2/r2/lib/db/queries.py @@ -768,8 +768,6 @@ def new_vote(vote, foreground=False): results.append(get_domain_links(domain, sort, "all")) add_queries(results, insert_items = item, foreground=foreground) - - vote._fast_query_timestamp_touch(user) if isinstance(item, Link): # must update both because we don't know if it's a changed diff --git a/r2/r2/lib/db/thing.py b/r2/r2/lib/db/thing.py index a32d14186..58e64e2c2 100644 --- a/r2/r2/lib/db/thing.py +++ b/r2/r2/lib/db/thing.py @@ -778,30 +778,6 @@ def Relation(type1, type2, denorm1 = None, denorm2 = None): #know it's deleted. save -> unsave, hide -> unhide self._name = 'un' + self._name - @classmethod - def _fast_query_timestamp_touch(cls, thing1): - thing_utils.set_last_modified_for_cls(thing1, cls._type_name) - - @classmethod - def _can_skip_lookup(cls, thing1, thing2): - # we can't possibly have voted on things that were created - # after the last time we voted. for relations that have an - # invariant like this we can avoid doing these lookups as - # long as the relation takes responsibility for keeping - # the timestamp up-to-date - - last_done = thing_utils.get_last_modified_for_cls( - thing1, cls._type_name) - - if not last_done: - return False - - if thing2._date > last_done: - return True - - return False - - @classmethod def _fast_query(cls, thing1s, thing2s, name, data=True, eager_load=True, thing_data=False, timestamp_optimize = False): @@ -830,9 +806,6 @@ def Relation(type1, type2, denorm1 = None, denorm2 = None): t2_ids = set() names = set() for t1, t2, name in pairs: - if timestamp_optimize and cls._can_skip_lookup(thing1_dict[t1], - thing2_dict[t2]): - continue t1_ids.add(t1) t2_ids.add(t2) names.add(name) diff --git a/r2/r2/lib/utils/thing_utils.py b/r2/r2/lib/utils/thing_utils.py index 4e6b37e4b..3c3b0fabd 100644 --- a/r2/r2/lib/utils/thing_utils.py +++ b/r2/r2/lib/utils/thing_utils.py @@ -28,21 +28,6 @@ def set_last_modified(thing, action): key = last_modified_key(thing, action) g.permacache.set(key, make_last_modified()) - -def set_last_modified_for_cls(user, cls_type_name): - if cls_type_name != "vote_account_link": - set_last_modified(user, "cls_" + cls_type_name) - -def get_last_modified_for_cls(user, cls_type_name): - # vote times are already stored in the permacache and updated by the - # query queue - if cls_type_name == "vote_account_link": - return max(last_modified_date(user, "liked"), - last_modified_date(user, "disliked")) - # other types are not -- special key for them - elif cls_type_name in ("vote_account_comment", "savehide"): - return last_modified_date(user, "cls_" + cls_type_name) - def last_modified_multi(things, action): from pylons import g cache = g.permacache @@ -52,12 +37,3 @@ def last_modified_multi(things, action): last_modified = cache.get_multi(keys.keys()) return dict((keys[k], v) for k, v in last_modified.iteritems()) - - -def set_last_visit(thing): - from pylons import g - from r2.lib.cache import CL_ONE - key = last_modified_key(thing, "visit") - g.permacache.set(key, make_last_modified()) - - diff --git a/r2/r2/models/account.py b/r2/r2/models/account.py index aeecee111..6f1a6c371 100644 --- a/r2/r2/models/account.py +++ b/r2/r2/models/account.py @@ -24,7 +24,7 @@ from r2.lib.db.operators import lower from r2.lib.db.userrel import UserRel from r2.lib.memoize import memoize from r2.lib.utils import modhash, valid_hash, randstr, timefromnow -from r2.lib.utils import UrlParser, set_last_visit +from r2.lib.utils import UrlParser from r2.lib.utils import constant_time_compare from r2.lib.cache import sgm from r2.lib import filters diff --git a/r2/r2/models/link.py b/r2/r2/models/link.py index 594ad786b..4f97c516c 100755 --- a/r2/r2/models/link.py +++ b/r2/r2/models/link.py @@ -146,7 +146,6 @@ class Link(Thing, Printable): except CreationError, e: return somethinged(user, self)[(user, self, name)] - rel._fast_query_timestamp_touch(user) return saved def _unsomething(self, user, somethinged, name): diff --git a/r2/r2/models/vote.py b/r2/r2/models/vote.py index c9b5519a6..5934f8344 100644 --- a/r2/r2/models/vote.py +++ b/r2/r2/models/vote.py @@ -215,8 +215,6 @@ class Vote(MultiRelation('vote', v._commit() - v._fast_query_timestamp_touch(sub) - up_change, down_change = score_changes(amount, oldamount) if not (is_new and obj.author_id == sub._id and amount == 1):