queries: Parameterize queue name for run_commentstree.

This allows us to reuse the code for a queue of the same meaning but
different name (i.e. a commentstree fastlane).
This commit is contained in:
Neil Williams
2012-08-28 09:34:52 -07:00
parent 1b6423a073
commit 5ba0618963

View File

@@ -1269,10 +1269,10 @@ def run_new_comments(limit=1000):
amqp.handle_items('newcomments_q', _run_new_comments, limit=limit)
def run_commentstree(limit=100):
def run_commentstree(qname="commentstree_q", limit=100):
"""Add new incoming comments to their respective comments trees"""
@g.stats.amqp_processor('commentstree_q')
@g.stats.amqp_processor(qname)
def _run_commentstree(msgs, chan):
comments = Comment._by_fullname([msg.body for msg in msgs],
data = True, return_dict = False)
@@ -1280,7 +1280,7 @@ def run_commentstree(limit=100):
add_comment_tree(comments)
amqp.handle_items('commentstree_q', _run_commentstree, limit = limit)
amqp.handle_items(qname, _run_commentstree, limit = limit)
vote_link_q = 'vote_link_q'
vote_comment_q = 'vote_comment_q'