From e4b05334902cf748be97137ad5c429d4a3cd71bc Mon Sep 17 00:00:00 2001 From: Jumana Bahrainwala Date: Fri, 14 Feb 2025 18:53:39 +0000 Subject: [PATCH] fix --- notifications_utils/clients/redis/annual_limit.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/notifications_utils/clients/redis/annual_limit.py b/notifications_utils/clients/redis/annual_limit.py index 34d47543..944e9bc4 100644 --- a/notifications_utils/clients/redis/annual_limit.py +++ b/notifications_utils/clients/redis/annual_limit.py @@ -253,6 +253,9 @@ def set_seeded_at(self, service_id): self._redis_client.set_hash_value( annual_limit_notifications_v2_key(service_id), SEEDED_AT, datetime.utcnow().strftime("%Y-%m-%d") ) + # TODO: Remove the below once all services have been migrated to the new Redis structure + # Setting the seeded at in status for backward compatibility + self._redis_client.set_hash_value(annual_limit_status_key(service_id), SEEDED_AT, datetime.utcnow().strftime("%Y-%m-%d")) def clear_notification_counts(self, service_id: str): """ @@ -286,6 +289,8 @@ def get_annual_limit_status(self, service_id: str, field: str): Returns: str | None: The date the status was set, or None if the status has not been set """ + if field == "seeded_at": + return self.get_seeded_at(service_id) response = self._redis_client.get_hash_field(annual_limit_status_key(service_id), field) return response and response.decode("utf-8")