only trigger DVLA tasks if there is data to send

This commit is contained in:
Leo Hemsted
2017-09-22 14:06:31 +01:00
parent 04412fd314
commit cdc8acb49a

View File

@@ -316,6 +316,7 @@ def populate_monthly_billing():
@statsd(namespace="tasks")
def run_letter_jobs():
job_ids = dao_get_letter_job_ids_by_status(JOB_STATUS_READY_TO_SEND)
if job_ids:
notify_celery.send_task(
name=TaskNames.DVLA_JOBS,
args=(job_ids,),
@@ -331,6 +332,7 @@ def run_letter_notifications():
notifications = dao_set_created_live_letter_api_notifications_to_pending()
if notifications:
file_contents = create_dvla_file_contents_for_notifications(notifications)
file_location = '{}-dvla-notifications.txt'.format(current_time)