mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-19 05:58:53 -04:00
Trigger collate-letter-pdfs-for-day task if notis to process
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from datetime import (
|
||||
date,
|
||||
datetime,
|
||||
timedelta
|
||||
)
|
||||
@@ -33,6 +34,7 @@ from app.dao.notifications_dao import (
|
||||
dao_timeout_notifications,
|
||||
is_delivery_slow_for_provider,
|
||||
delete_notifications_created_more_than_a_week_ago_by_type,
|
||||
dao_get_count_of_letters_to_process_for_date,
|
||||
dao_get_scheduled_notifications,
|
||||
set_scheduled_notification_to_processed,
|
||||
dao_set_created_live_letter_api_notifications_to_pending,
|
||||
@@ -355,6 +357,20 @@ def run_letter_jobs():
|
||||
current_app.logger.info("Queued {} ready letter job ids onto {}".format(len(job_ids), QueueNames.PROCESS_FTP))
|
||||
|
||||
|
||||
@notify_celery.task(name="run-letter-pdfs")
|
||||
@statsd(namespace="tasks")
|
||||
def run_letter_pdfs():
|
||||
letter_pdfs_count = dao_get_count_of_letters_to_process_for_date()
|
||||
if letter_pdfs_count:
|
||||
notify_celery.send_task(
|
||||
name='collate-letter-pdfs-for-day',
|
||||
args=(date.today().strftime("%Y-%m-%d"),),
|
||||
queue=QueueNames.LETTERS
|
||||
)
|
||||
current_app.logger.info("{} letter pdfs to be process by {} task".format(
|
||||
letter_pdfs_count, 'collate-letter-pdfs-for-day'))
|
||||
|
||||
|
||||
@notify_celery.task(name="run-letter-api-notifications")
|
||||
@statsd(namespace="tasks")
|
||||
def run_letter_api_notifications():
|
||||
|
||||
Reference in New Issue
Block a user