mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 07:19:25 -05:00
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:
@@ -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
|
||||
|
||||
@@ -186,6 +186,7 @@ class Globals(object):
|
||||
],
|
||||
ConfigValue.tuple: [
|
||||
'sr_discovery_links',
|
||||
'fastlane_links',
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user