mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Merge branch 'master' into refactor-send_notifications
Conflicts: tests/app/notifications/rest/test_send_notification.py
This commit is contained in:
@@ -12,7 +12,7 @@ from app import (
|
||||
encryption
|
||||
)
|
||||
from app.aws import s3
|
||||
from app.celery.provider_tasks import send_sms_to_provider, send_email_to_provider
|
||||
from app.celery import provider_tasks
|
||||
from app.dao.jobs_dao import (
|
||||
dao_update_job,
|
||||
dao_get_job_by_id
|
||||
@@ -81,7 +81,7 @@ def process_job(job_id):
|
||||
create_uuid(),
|
||||
encrypted,
|
||||
datetime.utcnow().strftime(DATETIME_FORMAT)),
|
||||
queue='db-sms'
|
||||
queue='db-sms' if not service.research_mode else 'research-mode'
|
||||
)
|
||||
|
||||
if template.template_type == EMAIL_TYPE:
|
||||
@@ -90,7 +90,8 @@ def process_job(job_id):
|
||||
create_uuid(),
|
||||
encrypted,
|
||||
datetime.utcnow().strftime(DATETIME_FORMAT)),
|
||||
queue='db-email')
|
||||
queue='db-email' if not service.research_mode else 'research-mode'
|
||||
)
|
||||
|
||||
finished = datetime.utcnow()
|
||||
job.status = 'finished'
|
||||
@@ -126,7 +127,10 @@ def send_sms(self,
|
||||
created_at, notification, notification_id, service.id, SMS_TYPE, api_key_id, key_type
|
||||
)
|
||||
)
|
||||
send_sms_to_provider.apply_async((service_id, notification_id), queue='send-sms')
|
||||
provider_tasks.deliver_sms.apply_async(
|
||||
[notification_id],
|
||||
queue='send-sms' if not service.research_mode else 'research-mode'
|
||||
)
|
||||
|
||||
current_app.logger.info(
|
||||
"SMS {} created at {}".format(notification_id, created_at)
|
||||
@@ -165,7 +169,10 @@ def send_email(self, service_id,
|
||||
)
|
||||
)
|
||||
|
||||
send_email_to_provider.apply_async((service_id, notification_id), queue='send-email')
|
||||
provider_tasks.deliver_email.apply_async(
|
||||
[notification_id],
|
||||
queue='send-email' if not service.research_mode else 'research-mode'
|
||||
)
|
||||
|
||||
current_app.logger.info("Email {} created at {}".format(notification_id, created_at))
|
||||
except SQLAlchemyError as e:
|
||||
|
||||
Reference in New Issue
Block a user