Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annual Limit daily delivered & failed notification counts and seeding implementation #333

Merged
merged 8 commits into from
Nov 12, 2024

Conversation

whabanks
Copy link
Contributor

@whabanks whabanks commented Nov 4, 2024

Summary | Résumé

This PR completes the annual limit Redis client.

  • New base functionality available to all Redis clients to bulk update / delete Hash fields
    • Fields can be manipulated via a list of keys or by using a key pattern
  • Set and check the seeded_at values for notification counts
  • Clear / reset daily notification counts

This will be called during create_nightly_notification_status_for_day to reset daily failed and delivered counts in Redis.

Related Issues | Cartes liées

Test instructions | Instructions pour tester la modification

Tests pass & integrates with API.

Release Instructions | Instructions pour le déploiement

None.

Reviewer checklist | Liste de vérification du réviseur

  • This PR does not break existing functionality.
  • This PR does not violate GCNotify's privacy policies.
  • This PR does not raise new security concerns. Refer to our GC Notify Risk Register document on our Google drive.
  • This PR does not significantly alter performance.
  • Additional required documentation resulting of these changes is covered (such as the README, setup instructions, a related ADR or the technical documentation).

⚠ If boxes cannot be checked off before merging the PR, they should be moved to the "Release Instructions" section with appropriate steps required to verify before release. For example, changes to celery code may require tests on staging to verify that performance has not been affected.

- Added new redis_client base method to bulk update hash values by pattern
"""
Resets all daily notification metrics for all services. Uses non-blocking scan_iter method to avoid locking the Redis server.
"""
pattern = notifications_key("*") # All notification keys regardless of service_id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename this key to the annual limits notification key?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it is already used in places, then it is fine

- create_nightly_notification_status_for_day processes services in chunks, so we'll also atomically reset cache values in chunks too
- Added doc string explaining hash structure in the annual limit client
@whabanks whabanks changed the title Add method to bulk reset notification counts Annual Limit daily delivered & failed notification counts and seeding implementation Nov 12, 2024
@whabanks whabanks requested a review from jzbahrai November 12, 2024 14:11
@whabanks whabanks merged commit 42ded1e into main Nov 12, 2024
4 checks passed
@whabanks whabanks deleted the task/add-bulk-count-clear branch November 12, 2024 18:29
@whabanks whabanks mentioned this pull request Nov 13, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants