Permalink
Browse files

Cut get_sent query over to new query cache.

  • Loading branch information...
1 parent ab039b4 commit e59b61d2cf167d82b131b6986c6b067a3df33961 @spladug spladug committed May 27, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 r2/r2/lib/db/queries.py
View
5 r2/r2/lib/db/queries.py
@@ -595,7 +595,7 @@ def get_inbox(user):
get_inbox_messages(user),
get_inbox_selfreply(user))
-@migrating_cached_query(UserQueryCache)
+@cached_query(UserQueryCache)
def get_sent(user_id):
return Message._query(Message.c.author_id == user_id,
Message.c._spam == (True, False),
@@ -789,9 +789,10 @@ def new_message(message, inbox_rels):
from_user = Account._byID(message.author_id)
for inbox_rel in tup(inbox_rels):
to = inbox_rel._thing1
- add_queries([get_sent(from_user)], insert_items=message)
with CachedQueryMutator() as m:
+ m.insert(get_sent(from_user), [message])
+
# moderator message
if isinstance(inbox_rel, ModeratorInbox):
m.insert(get_subreddit_messages(to), [inbox_rel])

0 comments on commit e59b61d

Please sign in to comment.