mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
cleanup
This commit is contained in:
@@ -179,7 +179,7 @@ def __total_sending_limits_for_job_exceeded(service, job, job_id):
|
||||
dao_update_job(job)
|
||||
current_app.logger.exception(
|
||||
"Job {} size {} error. Total sending limits {} exceeded".format(
|
||||
job_id, job.notification_count, service.message_limit
|
||||
job_id, job.notification_count, service.total_message_limit
|
||||
),
|
||||
)
|
||||
return True
|
||||
|
||||
@@ -136,11 +136,15 @@ def send_sms_to_provider(notification):
|
||||
msg = f"Send to AWS!!! for job_id {n.job_id} row_number {n.job_row_number} message_id {message_id}"
|
||||
current_app.logger.info(hilite(msg))
|
||||
notification.billable_units = template.fragment_count
|
||||
current_app.logger.info("GOING TO UPDATE NOTI TO SENDING")
|
||||
update_notification_to_sending(notification, provider)
|
||||
|
||||
cache_key = total_limit_cache_key(service.id)
|
||||
redis_store.incr(cache_key)
|
||||
current_app.logger.info(
|
||||
hilite(
|
||||
f"message count for service {n.service_id} now {redis_store.get(cache_key)}"
|
||||
)
|
||||
)
|
||||
return message_id
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ from app.models import ServicePermission
|
||||
from app.notifications.process_notifications import create_content_for_notification
|
||||
from app.serialised_models import SerialisedTemplate
|
||||
from app.service.utils import service_allowed_to_send_to
|
||||
from app.utils import get_public_notify_type_text, hilite
|
||||
from app.utils import get_public_notify_type_text
|
||||
from notifications_utils import SMS_CHAR_COUNT_LIMIT
|
||||
from notifications_utils.clients.redis import total_limit_cache_key
|
||||
from notifications_utils.recipients import (
|
||||
@@ -46,21 +46,13 @@ def check_service_over_total_message_limit(key_type, service):
|
||||
service_stats = 0
|
||||
redis_store.set(cache_key, service_stats, ex=seconds_difference)
|
||||
return service_stats
|
||||
# TODO CHANGE THIS BACK TO SERVICE TOTAL MESSAGE LIMIT
|
||||
if int(service_stats) >= 5:
|
||||
# if int(service_stats) >= service.total_message_limit:
|
||||
if int(service_stats) >= service.total_message_limit:
|
||||
current_app.logger.warning(
|
||||
"service {} has been rate limited for total use sent {} limit {}".format(
|
||||
service.id, int(service_stats), service.total_message_limit
|
||||
)
|
||||
)
|
||||
raise TotalRequestsError(service.total_message_limit)
|
||||
else:
|
||||
print(
|
||||
hilite(
|
||||
f"TOTAL MESSAGE LIMIT {service.total_message_limit} CURRENT {service_stats}"
|
||||
)
|
||||
)
|
||||
return int(service_stats)
|
||||
|
||||
|
||||
|
||||
@@ -1140,7 +1140,7 @@ def get_service_message_ratio():
|
||||
return {
|
||||
"messages_sent": messages_sent,
|
||||
"total_message_limit": my_service.total_message_limit,
|
||||
}
|
||||
}, 200
|
||||
|
||||
|
||||
@service_blueprint.route("/monthly-data-by-service")
|
||||
|
||||
Reference in New Issue
Block a user