Disable Redis for Staging added statsd for post methods

- Disable Redis as there is a current connection limit of 256 which
 could slow down the request if they are all used
 - Added statd to methods in the post to help spot any bottlenecks
This commit is contained in:
Richard Chapman
2017-12-01 15:30:18 +00:00
parent 64c67dea5e
commit 5f25d3162a
5 changed files with 18 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ from app.models import (
KEY_TYPE_TEST, KEY_TYPE_TEAM, SCHEDULE_NOTIFICATIONS
)
from app.service.utils import service_allowed_to_send_to
from app.statsd_decorators import statsd
from app.v2.errors import TooManyRequestsError, BadRequestError, RateLimitError
from app import redis_store
from app.notifications.process_notifications import create_content_for_notification
@@ -46,6 +47,7 @@ def check_service_over_daily_message_limit(key_type, service):
raise TooManyRequestsError(service.message_limit)
@statsd(namespace="performance-testing")
def check_rate_limiting(service, api_key):
check_service_over_api_rate_limit(service, api_key)
check_service_over_daily_message_limit(api_key.key_type, service)
@@ -80,12 +82,14 @@ def service_has_permission(notify_type, permissions):
return notify_type in [p.permission for p in permissions]
@statsd(namespace="performance-testing")
def check_service_has_permission(notify_type, permissions):
if not service_has_permission(notify_type, permissions):
raise BadRequestError(message="Cannot send {}".format(
get_public_notify_type_text(notify_type, plural=True)))
@statsd(namespace="performance-testing")
def check_service_can_schedule_notification(permissions, scheduled_for):
if scheduled_for:
if not service_has_permission(SCHEDULE_NOTIFICATIONS, permissions):
@@ -117,6 +121,7 @@ def check_sms_content_char_count(content_count):
raise BadRequestError(message=message)
@statsd(namespace="performance-testing")
def validate_template(template_id, personalisation, service, notification_type):
try:
template = templates_dao.dao_get_template_by_id_and_service_id(