mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 08:51:30 -05:00
Remove unnecessary statsd_client parameter
It turns out this is available from the app object [1], and we were
already assuming this in the tests.
[1]: 48c6c822e8/notifications_utils/clients/statsd/statsd_client.py (L52)
This commit is contained in:
@@ -110,7 +110,7 @@ def create_app(application):
|
|||||||
email_clients = [aws_ses_stub_client] if application.config['SES_STUB_URL'] else [aws_ses_client]
|
email_clients = [aws_ses_stub_client] if application.config['SES_STUB_URL'] else [aws_ses_client]
|
||||||
notification_provider_clients.init_app(sms_clients=[firetext_client, mmg_client], email_clients=email_clients)
|
notification_provider_clients.init_app(sms_clients=[firetext_client, mmg_client], email_clients=email_clients)
|
||||||
|
|
||||||
notify_celery.init_app(application, statsd_client)
|
notify_celery.init_app(application)
|
||||||
encryption.init_app(application)
|
encryption.init_app(application)
|
||||||
redis_store.init_app(application)
|
redis_store.init_app(application)
|
||||||
document_download_client.init_app(application)
|
document_download_client.init_app(application)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ def log_on_worker_shutdown(sender, signal, pid, exitcode, **kwargs):
|
|||||||
notify_celery._app.logger.info('worker shutdown: PID: {} Exitcode: {}'.format(pid, exitcode))
|
notify_celery._app.logger.info('worker shutdown: PID: {} Exitcode: {}'.format(pid, exitcode))
|
||||||
|
|
||||||
|
|
||||||
def make_task(app, statsd_client):
|
def make_task(app):
|
||||||
class NotifyTask(Task):
|
class NotifyTask(Task):
|
||||||
abstract = True
|
abstract = True
|
||||||
start = None
|
start = None
|
||||||
@@ -36,7 +36,7 @@ def make_task(app, statsd_client):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
statsd_client.timing(
|
app.statsd_client.timing(
|
||||||
"celery.{queue_name}.{task_name}.success".format(
|
"celery.{queue_name}.{task_name}.success".format(
|
||||||
task_name=self.name,
|
task_name=self.name,
|
||||||
queue_name=queue_name
|
queue_name=queue_name
|
||||||
@@ -54,7 +54,7 @@ def make_task(app, statsd_client):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
statsd_client.incr(
|
app.statsd_client.incr(
|
||||||
"celery.{queue_name}.{task_name}.failure".format(
|
"celery.{queue_name}.{task_name}.failure".format(
|
||||||
task_name=self.name,
|
task_name=self.name,
|
||||||
queue_name=queue_name
|
queue_name=queue_name
|
||||||
@@ -88,11 +88,11 @@ def make_task(app, statsd_client):
|
|||||||
|
|
||||||
class NotifyCelery(Celery):
|
class NotifyCelery(Celery):
|
||||||
|
|
||||||
def init_app(self, app, statsd_client):
|
def init_app(self, app):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
app.import_name,
|
app.import_name,
|
||||||
broker=app.config['BROKER_URL'],
|
broker=app.config['BROKER_URL'],
|
||||||
task_cls=make_task(app, statsd_client),
|
task_cls=make_task(app),
|
||||||
)
|
)
|
||||||
|
|
||||||
self.conf.update(app.config)
|
self.conf.update(app.config)
|
||||||
|
|||||||
Reference in New Issue
Block a user