Permalink
Browse files

voting: Don't use fastlane vote processor

The fastlane processor was meant to handle votes on both Links and Comments,
but it can't do that easily anymore now that the vote processing has been
split. It's not a big deal now because Link vote processing is much faster
now that the query updating has been separated and sharded. The Comment vote
consumer/queue was getting some benefit from the fastlane and it can be
resurrected if we run into problems.
  • Loading branch information...
1 parent d48c387 commit da00f3eefb0aaf6763f4d1012aef069ce59a3b03 @bsimpson63 bsimpson63 committed Nov 3, 2016
Showing with 13 additions and 30 deletions.
  1. +0 −1 r2/r2/config/queues.py
  2. +13 −1 r2/r2/lib/voting.py
  3. +0 −14 r2/r2/models/link.py
  4. +0 −14 upstart/reddit-consumer-vote_fastlane_q.conf
@@ -79,7 +79,6 @@ def declare_queues(g):
"commentstree_fastlane_q": MessageQueue(bind_to_self=True),
"vote_link_q": MessageQueue(bind_to_self=True),
"vote_comment_q": MessageQueue(bind_to_self=True),
- "vote_fastlane_q": MessageQueue(bind_to_self=True),
"cloudsearch_changes": MessageQueue(bind_to_self=True),
"butler_q": MessageQueue(),
"markread_q": MessageQueue(),
View
@@ -55,6 +55,9 @@ def update_vote_lookups(user, thing, direction):
def cast_vote(user, thing, direction, **data):
"""Register a vote and queue it for processing."""
+ if not isinstance(thing, (Link, Comment)):
+ return
+
update_vote_lookups(user, thing, direction)
vote_data = {
@@ -84,10 +87,19 @@ def cast_vote(user, thing, direction, **data):
"context": Event.get_context_data(request, c),
"sensitive": Event.get_sensitive_context_data(request, c),
}
+
try:
- amqp.add_item(thing.vote_queue_name, json.dumps(vote_data))
+ vote_dump = json.dumps(vote_data)
except UnicodeDecodeError:
g.log.error("Got weird unicode in the vote data: %r", vote_data)
+ return
+
+ if isinstance(thing, Link):
+ queue = "vote_link_q"
+ elif isinstance(thing, Comment):
+ queue = "vote_comment_q"
+
+ amqp.add_item(queue, vote_dump)
def update_user_liked(vote):
View
@@ -152,13 +152,6 @@ def __init__(self, *a, **kw):
Thing.__init__(self, *a, **kw)
@property
- def vote_queue_name(self):
- if self._id36 in g.live_config["fastlane_links"]:
- return "vote_fastlane_q"
- else:
- return "vote_link_q"
-
- @property
def affects_karma_type(self):
if self.is_self:
return "self"
@@ -1284,13 +1277,6 @@ def _markdown(self):
pass
@property
- def vote_queue_name(self):
- if utils.to36(self.link_id) in g.live_config["fastlane_links"]:
- return "vote_fastlane_q"
- else:
- return "vote_comment_q"
-
- @property
def affects_karma_type(self):
return "comment"
@@ -1,14 +0,0 @@
-description "vote_q processor - dedicated fastlane edition"
-
-instance $x
-
-stop on reddit-stop or runlevel [016]
-
-respawn
-respawn limit 10 5
-
-nice 10
-script
- . /etc/default/reddit
- wrap-job paster run --proctitle vote_fastlane_q$x $REDDIT_INI -c 'from r2.lib.voting import consume_link_vote_queue; consume_link_vote_queue("vote_fastlane_q")'
-end script

0 comments on commit da00f3e

Please sign in to comment.