mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
Rename task and function for clarity
This doesn't just relate to precompiled letters, it's actually just checking that there are not any letters still waiting for a virus check that should not be. This change to the naming makes it more accurate and therefore easy to understand
This commit is contained in:
@@ -192,9 +192,9 @@ def replay_created_notifications():
|
|||||||
get_pdf_for_templated_letter.apply_async([str(letter.id)], queue=QueueNames.CREATE_LETTERS_PDF)
|
get_pdf_for_templated_letter.apply_async([str(letter.id)], queue=QueueNames.CREATE_LETTERS_PDF)
|
||||||
|
|
||||||
|
|
||||||
@notify_celery.task(name='check-precompiled-letter-state')
|
@notify_celery.task(name='check-if-letters-still-pending-virus-check')
|
||||||
@statsd(namespace="tasks")
|
@statsd(namespace="tasks")
|
||||||
def check_precompiled_letter_state():
|
def check_if_letters_still_pending_virus_check():
|
||||||
letters = dao_precompiled_letters_still_pending_virus_check()
|
letters = dao_precompiled_letters_still_pending_virus_check()
|
||||||
|
|
||||||
if len(letters) > 0:
|
if len(letters) > 0:
|
||||||
|
|||||||
@@ -289,8 +289,8 @@ class Config(object):
|
|||||||
'schedule': crontab(day_of_week='mon-fri', hour=9, minute=0),
|
'schedule': crontab(day_of_week='mon-fri', hour=9, minute=0),
|
||||||
'options': {'queue': QueueNames.PERIODIC}
|
'options': {'queue': QueueNames.PERIODIC}
|
||||||
},
|
},
|
||||||
'check-precompiled-letter-state': {
|
'check-if-letters-still-pending-virus-check': {
|
||||||
'task': 'check-precompiled-letter-state',
|
'task': 'check-if-letters-still-pending-virus-check',
|
||||||
'schedule': crontab(day_of_week='mon-fri', hour='9,15', minute=0),
|
'schedule': crontab(day_of_week='mon-fri', hour='9,15', minute=0),
|
||||||
'options': {'queue': QueueNames.PERIODIC}
|
'options': {'queue': QueueNames.PERIODIC}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from app.celery.scheduled_tasks import (
|
|||||||
delete_verify_codes,
|
delete_verify_codes,
|
||||||
run_scheduled_jobs,
|
run_scheduled_jobs,
|
||||||
replay_created_notifications,
|
replay_created_notifications,
|
||||||
check_precompiled_letter_state,
|
check_if_letters_still_pending_virus_check,
|
||||||
check_if_letters_still_in_created,
|
check_if_letters_still_in_created,
|
||||||
check_for_missing_rows_in_completed_jobs,
|
check_for_missing_rows_in_completed_jobs,
|
||||||
check_for_services_with_high_failure_rates_or_sending_to_tv_numbers,
|
check_for_services_with_high_failure_rates_or_sending_to_tv_numbers,
|
||||||
@@ -319,7 +319,7 @@ def test_check_job_status_task_does_not_raise_error(sample_template):
|
|||||||
|
|
||||||
|
|
||||||
@freeze_time("2019-05-30 14:00:00")
|
@freeze_time("2019-05-30 14:00:00")
|
||||||
def test_check_precompiled_letter_state(mocker, sample_letter_template):
|
def test_check_if_letters_still_pending_virus_check(mocker, sample_letter_template):
|
||||||
mock_logger = mocker.patch('app.celery.tasks.current_app.logger.warning')
|
mock_logger = mocker.patch('app.celery.tasks.current_app.logger.warning')
|
||||||
mock_create_ticket = mocker.patch('app.celery.nightly_tasks.zendesk_client.create_ticket')
|
mock_create_ticket = mocker.patch('app.celery.nightly_tasks.zendesk_client.create_ticket')
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ def test_check_precompiled_letter_state(mocker, sample_letter_template):
|
|||||||
created_at=datetime.utcnow() - timedelta(seconds=70000),
|
created_at=datetime.utcnow() - timedelta(seconds=70000),
|
||||||
reference='two')
|
reference='two')
|
||||||
|
|
||||||
check_precompiled_letter_state()
|
check_if_letters_still_pending_virus_check()
|
||||||
|
|
||||||
id_references = sorted([(str(notification_1.id), notification_1.reference),
|
id_references = sorted([(str(notification_1.id), notification_1.reference),
|
||||||
(str(notification_2.id), notification_2.reference)])
|
(str(notification_2.id), notification_2.reference)])
|
||||||
|
|||||||
Reference in New Issue
Block a user