Make ErrorReporter run successfully on Zulip voyager.

(imported from commit 8ab2fb57fb3e580775cb8959e3b8b5a1277ea9d3)
This commit is contained in:
Tim Abbott 2015-09-25 04:09:16 -07:00
parent 81fe34d011
commit 1156a82297
1 changed files with 6 additions and 3 deletions

View File

@ -225,16 +225,19 @@ class FeedbackBot(QueueProcessingWorker):
@assign_queue('error_reports')
class ErrorReporter(QueueProcessingWorker):
def start(self):
self.staging_client = make_feedback_client()
self.staging_client._register(
if settings.DEPLOYMENT_ROLE_KEY:
self.staging_client = make_feedback_client()
self.staging_client._register(
'forward_error',
method='POST',
url='deployments/report_error',
make_request=(lambda type, report: {'type': type, 'report': simplejson.dumps(report)}),
)
)
QueueProcessingWorker.start(self)
def consume(self, event):
if not settings.DEPLOYMENT_ROLE_KEY:
return
self.staging_client.forward_error(event['type'], event['report'])
@assign_queue('slow_queries')