mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-05 06:00:53 -04:00
fix total message limit so it works
This commit is contained in:
@@ -14,6 +14,7 @@ from app.dao.notifications_dao import update_notification_status_by_id
|
||||
from app.delivery import send_to_providers
|
||||
from app.enums import NotificationStatus
|
||||
from app.exceptions import NotificationTechnicalFailureException
|
||||
from notifications_utils.clients.redis import total_limit_cache_key
|
||||
|
||||
|
||||
@notify_celery.task(
|
||||
@@ -41,6 +42,9 @@ def deliver_sms(self, notification_id):
|
||||
# Code branches off to send_to_providers.py
|
||||
send_to_providers.send_sms_to_provider(notification)
|
||||
|
||||
cache_key = total_limit_cache_key(notification.service_id)
|
||||
redis_store.incr(cache_key)
|
||||
|
||||
except Exception as e:
|
||||
update_notification_status_by_id(
|
||||
notification_id,
|
||||
|
||||
@@ -166,7 +166,7 @@ def process_row(row, template, job, service, sender_id=None):
|
||||
# Assuming the limit is annual, is it calendar year, fiscal year, MOU year?
|
||||
# Do we need a command to run to clear the redis value, or should it happen automatically?
|
||||
def __total_sending_limits_for_job_exceeded(service, job, job_id):
|
||||
|
||||
print(hilite("ENTER __total_sending_limits_for_job_exceeded"))
|
||||
try:
|
||||
total_sent = check_service_over_total_message_limit(KeyType.NORMAL, service)
|
||||
if total_sent + job.notification_count > service.total_message_limit:
|
||||
|
||||
Reference in New Issue
Block a user