Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbahrai committed Feb 14, 2025
1 parent bbbd408 commit 7724771
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions notifications_utils/clients/redis/annual_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit 7724771

Please sign in to comment.