From 987445f1bfc80016ed37da9a69499a45a162386d Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Wed, 7 Nov 2018 16:49:48 +0000 Subject: [PATCH] ft_notification_status now updates data for 4 days back This was done so when notification is timed out from sending/pending to temporary_failure, this change has to always be caught in the ft_notification_status --- app/celery/reporting_tasks.py | 6 +++--- app/config.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/celery/reporting_tasks.py b/app/celery/reporting_tasks.py index eb2741be1..efe3dae99 100644 --- a/app/celery/reporting_tasks.py +++ b/app/celery/reporting_tasks.py @@ -15,7 +15,7 @@ from app.dao.fact_notification_status_dao import fetch_notification_status_for_d @statsd(namespace="tasks") def create_nightly_billing(day_start=None): # day_start is a datetime.date() object. e.g. - # 3 days of data counting back from day_start is consolidated + # up to 10 days of data counting back from day_start is consolidated if day_start is None: day_start = datetime.today() - timedelta(days=1) else: @@ -37,13 +37,13 @@ def create_nightly_billing(day_start=None): @statsd(namespace="tasks") def create_nightly_notification_status(day_start=None): # day_start is a datetime.date() object. e.g. - # 3 days of data counting back from day_start is consolidated + # 4 days of data counting back from day_start is consolidated if day_start is None: day_start = datetime.today() - timedelta(days=1) else: # When calling the task its a string in the format of "YYYY-MM-DD" day_start = datetime.strptime(day_start, "%Y-%m-%d") - for i in range(0, 3): + for i in range(0, 4): process_day = day_start - timedelta(days=i) transit_data = fetch_notification_status_for_day(process_day=process_day) diff --git a/app/config.py b/app/config.py index 80e98bf9b..c828b4644 100644 --- a/app/config.py +++ b/app/config.py @@ -208,22 +208,22 @@ class Config(object): }, 'create-nightly-notification-status': { 'task': 'create-nightly-notification-status', - 'schedule': crontab(hour=0, minute=30), # after 'timeout-sending-notifications' + 'schedule': crontab(hour=0, minute=30), # after 'timeout-sending-notifications' 'options': {'queue': QueueNames.PERIODIC} }, 'delete-sms-notifications': { 'task': 'delete-sms-notifications', - 'schedule': crontab(hour=0, minute=45), # after 'create-nightly-notification-status' + 'schedule': crontab(hour=0, minute=45), # after 'create-nightly-notification-status' 'options': {'queue': QueueNames.PERIODIC} }, 'delete-email-notifications': { 'task': 'delete-email-notifications', - 'schedule': crontab(hour=1, minute=0), # after 'create-nightly-notification-status' + 'schedule': crontab(hour=1, minute=0), # after 'create-nightly-notification-status' 'options': {'queue': QueueNames.PERIODIC} }, 'delete-letter-notifications': { 'task': 'delete-letter-notifications', - 'schedule': crontab(hour=1, minute=20), # after 'create-nightly-notification-status' + 'schedule': crontab(hour=1, minute=20), # after 'create-nightly-notification-status' 'options': {'queue': QueueNames.PERIODIC} }, 'delete-inbound-sms': {