mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-31 01:38:08 -05:00
Clean up usage_q infrastructure.
This commit is contained in:
@@ -641,12 +641,15 @@ class MinimalController(BaseController):
|
||||
log_text("unknown action", "no action for %r" % path_info,
|
||||
"warning")
|
||||
if g.usage_sampling >= 1.0 or rand.random() < g.usage_sampling:
|
||||
|
||||
amqp.add_kw("usage_q",
|
||||
start_time = c.start_time,
|
||||
end_time = end_time,
|
||||
sampling_rate = g.usage_sampling,
|
||||
action = action)
|
||||
amqp.add_kw(
|
||||
"request_info",
|
||||
ip=request.ip,
|
||||
start_time=c.start_time,
|
||||
end_time=end_time,
|
||||
sampling_rate=g.usage_sampling,
|
||||
action=action,
|
||||
headers=dict(request.headers)
|
||||
)
|
||||
|
||||
# this thread is probably going to be reused, but it could be
|
||||
# a while before it is. So we might as well dump the cache in
|
||||
|
||||
@@ -73,17 +73,19 @@ class RedditQueueMap(QueueMap):
|
||||
self._q('vote_link_q', self_refer=True)
|
||||
self._q('vote_comment_q', self_refer=True)
|
||||
self._q('log_q', self_refer=True)
|
||||
self._q('usage_q', self_refer=True, durable=False)
|
||||
|
||||
self._q('solrsearch_changes')
|
||||
self._q('indextank_changes', self_refer=True)
|
||||
self._bind('search_changes', 'solrsearch_changes')
|
||||
self._bind('search_changes', 'indextank_changes')
|
||||
|
||||
self._q('usage_q', durable=False)
|
||||
|
||||
def bindings(self):
|
||||
self.newlink_bindings()
|
||||
self.newcomment_bindings()
|
||||
self.newsubreddit_bindings()
|
||||
self.requestinfo_bindings()
|
||||
|
||||
def newlink_bindings(self):
|
||||
self._bind('new_link', 'scraper_q')
|
||||
@@ -98,6 +100,9 @@ class RedditQueueMap(QueueMap):
|
||||
def newsubreddit_bindings(self):
|
||||
pass
|
||||
|
||||
def requestinfo_bindings(self):
|
||||
self._bind('request_info', 'usage_q')
|
||||
|
||||
try:
|
||||
from r2admin.lib.adminqueues import *
|
||||
except ImportError:
|
||||
|
||||
Reference in New Issue
Block a user