From 6908bd3cf5d35ae9f867067afb636564180d276b Mon Sep 17 00:00:00 2001 From: stvnrlly Date: Wed, 16 Nov 2022 12:51:46 -0500 Subject: [PATCH] use only convert_utc_to_local_timezone --- app/celery/nightly_tasks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/celery/nightly_tasks.py b/app/celery/nightly_tasks.py index 2f7a1207d..b561fa1bb 100644 --- a/app/celery/nightly_tasks.py +++ b/app/celery/nightly_tasks.py @@ -5,7 +5,7 @@ from flask import current_app from notifications_utils.clients.zendesk.zendesk_client import ( NotifySupportTicket, ) -from notifications_utils.timezones import convert_utc_to_est +from notifications_utils.timezones import convert_utc_to_local_timezone from sqlalchemy import func from sqlalchemy.exc import SQLAlchemyError @@ -91,7 +91,7 @@ def _delete_notifications_older_than_retention_by_type(notification_type): for f in flexible_data_retention: day_to_delete_backwards_from = get_local_midnight_in_utc( - convert_utc_to_est(datetime.utcnow()).date() - timedelta(days=f.days_of_retention) + convert_utc_to_local_timezone(datetime.utcnow()).date() - timedelta(days=f.days_of_retention) ) delete_notifications_for_service_and_type.apply_async(queue=QueueNames.REPORTING, kwargs={ @@ -100,7 +100,7 @@ def _delete_notifications_older_than_retention_by_type(notification_type): 'datetime_to_delete_before': day_to_delete_backwards_from }) - seven_days_ago = get_local_midnight_in_utc(convert_utc_to_est(datetime.utcnow()).date() - timedelta(days=7)) + seven_days_ago = get_local_midnight_in_utc(convert_utc_to_local_timezone(datetime.utcnow()).date() - timedelta(days=7)) service_ids_with_data_retention = {x.service_id for x in flexible_data_retention} # get a list of all service ids that we'll need to delete for. Typically that might only be 5% of services.