Merge branch 'master' into schedule-api-notification

Conflicts:
	app/celery/scheduled_tasks.py
	app/v2/notifications/post_notifications.py
	tests/app/celery/test_scheduled_tasks.py
This commit is contained in:
Rebecca Law
2017-05-22 14:05:57 +01:00
48 changed files with 1917 additions and 291 deletions

View File

@@ -15,7 +15,9 @@ from app.dao.notifications_dao import (
delete_notifications_created_more_than_a_week_ago,
dao_timeout_notifications,
is_delivery_slow_for_provider,
dao_get_scheduled_notifications)
dao_get_scheduled_notifications
)
from app.dao.statistics_dao import dao_timeout_job_statistics
from app.dao.provider_details_dao import (
get_current_provider,
dao_toggle_sms_provider
@@ -195,3 +197,12 @@ def switch_current_sms_provider_on_slow_delivery():
)
dao_toggle_sms_provider(current_provider.identifier)
@notify_celery.task(name='timeout-job-statistics')
@statsd(namespace="tasks")
def timeout_job_statistics():
updated = dao_timeout_job_statistics(current_app.config.get('SENDING_NOTIFICATIONS_TIMEOUT_PERIOD'))
if updated:
current_app.logger.info(
"Timeout period reached for {} job statistics, failure count has been updated.".format(updated))