fastlane: Separate votes on some links and their comments.

If a specific link has ridiculous traffic, we can inform the
apps (via ZK live config) that votes on it should be sent to a
separate, dedicated, queue to avoid overwhelming the rest of the
system.
This commit is contained in:
Neil Williams
2012-08-27 21:53:37 -07:00
parent 5ba0618963
commit c337280e47
4 changed files with 14 additions and 2 deletions

View File

@@ -496,6 +496,8 @@ beaker.session_secret = somesecret
[live_config]
# make frontpage 100% dart
frontpage_dart = false
# links that get their own infrastructure (comma-delimited list of id36s)
fastlane_links =
# spotlight links for subreddit discovery
sr_discovery_links =
# probability of the subreddit suggester showing up in the spotlight box

View File

@@ -186,6 +186,7 @@ class Globals(object):
],
ConfigValue.tuple: [
'sr_discovery_links',
'fastlane_links',
],
}

View File

@@ -1284,6 +1284,7 @@ def run_commentstree(qname="commentstree_q", limit=100):
vote_link_q = 'vote_link_q'
vote_comment_q = 'vote_comment_q'
vote_fastlane_q = 'vote_fastlane_q'
def queue_vote(user, thing, dir, ip, organic = False,
cheater = False, store = True):
@@ -1294,9 +1295,16 @@ def queue_vote(user, thing, dir, ip, organic = False,
if store:
if g.amqp_host:
if isinstance(thing, Link):
qname = vote_link_q
if thing._id36 in g.live_config["fastlane_links"]:
qname = vote_fastlane_q
else:
qname = vote_link_q
elif isinstance(thing, Comment):
qname = vote_comment_q
if utils.to36(thing.link_id) in g.live_config["fastlane_links"]:
qname = vote_fastlane_q
else:
qname = vote_comment_q
else:
log.warning("%s tried to vote on %r. that's not a link or comment!",
user, thing)

View File

@@ -73,6 +73,7 @@ class RedditQueueMap(QueueMap):
self._q('register_vote_q', self_refer=True)
self._q('vote_link_q', self_refer=True)
self._q('vote_comment_q', self_refer=True)
self._q('vote_fastlane_q', self_refer=True)
self._q('log_q', self_refer=True)
self._q('usage_q', self_refer=True, durable=False)