mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-14 01:02:09 -05:00
Reinstating the 2 task model for API submitted notifications.
This is being done for the PaaS migration to allow us to keep traffic coming in whilst we migrate the database. uses the same tasks as the CSV uploaded notifications. Simple changes to not persist the notification, and call into a different task.
This commit is contained in:
@@ -123,6 +123,39 @@ def process_row(row_number, recipient, personalisation, template, job, service):
|
||||
)
|
||||
|
||||
|
||||
def send_notification_to_persist_queue(
|
||||
notification_id, service, template_type, encrypted, priority=False, research_mode=False
|
||||
):
|
||||
queues = {
|
||||
SMS_TYPE: 'db-sms',
|
||||
EMAIL_TYPE: 'db-email'
|
||||
}
|
||||
|
||||
send_fns = {
|
||||
SMS_TYPE: send_sms,
|
||||
EMAIL_TYPE: send_email
|
||||
}
|
||||
|
||||
send_fn = send_fns[template_type]
|
||||
|
||||
if research_mode:
|
||||
queue_name = "research-mode"
|
||||
elif priority:
|
||||
queue_name = "notify"
|
||||
else:
|
||||
queue_name = queues[template_type]
|
||||
|
||||
send_fn.apply_async(
|
||||
(
|
||||
str(service.id),
|
||||
notification_id,
|
||||
encrypted,
|
||||
datetime.utcnow().strftime(DATETIME_FORMAT)
|
||||
),
|
||||
queue=queue_name
|
||||
)
|
||||
|
||||
|
||||
def __sending_limits_for_job_exceeded(service, job, job_id):
|
||||
total_sent = fetch_todays_total_message_count(service.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user