From 67905c277eca5901124f54b75a36eef466329e91 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 25 Aug 2014 19:13:40 -0400 Subject: [PATCH] Remove webhook worker --- Dockerfile.web | 3 --- conf/init/webhookworker/log/run | 2 -- conf/init/webhookworker/run | 8 ------- workers/webhookworker.py | 41 --------------------------------- 4 files changed, 54 deletions(-) delete mode 100755 conf/init/webhookworker/log/run delete mode 100755 conf/init/webhookworker/run delete mode 100644 workers/webhookworker.py diff --git a/Dockerfile.web b/Dockerfile.web index 448a7f748..e1d253632 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -39,9 +39,6 @@ ADD conf/init/nginx /etc/service/nginx ADD conf/init/diffsworker /etc/service/diffsworker ADD conf/init/notificationworker /etc/service/notificationworker -# TODO: Remove this after the prod CL push -ADD conf/init/webhookworker /etc/service/webhookworker - # Download any external libs. RUN mkdir static/fonts static/ldn RUN venv/bin/python -m external_libraries diff --git a/conf/init/webhookworker/log/run b/conf/init/webhookworker/log/run deleted file mode 100755 index 6738f16f8..000000000 --- a/conf/init/webhookworker/log/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec svlogd -t /var/log/webhookworker/ \ No newline at end of file diff --git a/conf/init/webhookworker/run b/conf/init/webhookworker/run deleted file mode 100755 index 04521552a..000000000 --- a/conf/init/webhookworker/run +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/bash - -echo 'Starting webhook worker' - -cd / -venv/bin/python -m workers.webhookworker - -echo 'Webhook worker exited' \ No newline at end of file diff --git a/workers/webhookworker.py b/workers/webhookworker.py deleted file mode 100644 index ccff884c2..000000000 --- a/workers/webhookworker.py +++ /dev/null @@ -1,41 +0,0 @@ -import logging -import argparse -import requests -import json - -from app import webhook_queue -from workers.worker import Worker - - -root_logger = logging.getLogger('') -root_logger.setLevel(logging.DEBUG) - -FORMAT = '%(asctime)-15s - %(levelname)s - %(pathname)s - %(funcName)s - %(message)s' -formatter = logging.Formatter(FORMAT) - -logger = logging.getLogger(__name__) - - -class WebhookWorker(Worker): - def process_queue_item(self, job_details): - url = job_details['url'] - payload = job_details['payload'] - headers = {'Content-type': 'application/json'} - - try: - resp = requests.post(url, data=json.dumps(payload), headers=headers) - if resp.status_code/100 != 2: - logger.error('%s response for webhook to url: %s' % (resp.status_code, - url)) - return False - except requests.exceptions.RequestException as ex: - logger.exception('Webhook was unable to be sent: %s' % ex.message) - return False - - return True - -logging.config.fileConfig('conf/logging.conf', disable_existing_loggers=False) - -worker = WebhookWorker(webhook_queue, poll_period_seconds=15, - reservation_seconds=3600) -worker.start() \ No newline at end of file