mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
Merge pull request #866 from alphagov/no-downtime-hosting-migration
Reinstating the 2 task model for API submitted notifications.
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