From 1fbe4277864f5b510042c3c1970ca95c21aa055d Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 10 Jan 2025 12:03:00 -0800 Subject: [PATCH] revert behavior for emails, only sms needs optimization --- app/notifications/process_notifications.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/notifications/process_notifications.py b/app/notifications/process_notifications.py index 2be547f7a..f6feca539 100644 --- a/app/notifications/process_notifications.py +++ b/app/notifications/process_notifications.py @@ -7,6 +7,7 @@ from app import redis_store from app.celery import provider_tasks from app.config import QueueNames from app.dao.notifications_dao import ( + dao_create_notification, dao_delete_notifications_by_id, dao_notification_exists, get_notification_by_id, @@ -139,18 +140,14 @@ def persist_notification( # if simulated create a Notification model to return but do not persist the Notification to the dB if not simulated: - # current_app.logger.info("Firing dao_create_notification") - # dao_create_notification(notification) - current_app.logger.info( - f"QUEUE LENTGH BEFOE {redis_store.llen("message_queue")}" - ) - redis_store.rpush( - "message_queue", json.dumps(notification.serialize_for_redis(notification)) - ) + if notification.notification_type == NotificationType.SMS: + redis_store.rpush( + "message_queue", + json.dumps(notification.serialize_for_redis(notification)), + ) + else: + dao_create_notification(notification) - current_app.logger.info( - f"QUEUE LENTGH AFTA {redis_store.llen("message_queue")}" - ) return notification