Skip to content

Commit

Permalink
Add method to populate all notification count fields during seeding
Browse files Browse the repository at this point in the history
  • Loading branch information
whabanks committed Nov 7, 2024
1 parent 089738d commit c73808e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions notifications_utils/clients/redis/annual_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ def reset_all_notification_counts(self, service_ids=None):

self._redis_client.delete_hash_fields(hashes=hashes)

def seed_annual_limit_notifications(self, service_id: str, mapping: dict):
self._redis_client.bulk_set_hash_fields(key=annual_limit_notifications_key(service_id), mapping=mapping)

def was_seeded_today(self, service_id):
last_seeded_time = self.get_seeded_at(service_id)
return last_seeded_time == datetime.utcnow().strftime("%Y-%m-%d") if last_seeded_time else False
Expand Down

0 comments on commit c73808e

Please sign in to comment.