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

DB Optimizations - Service SMS Sender #2253

Open
8 tasks
k-macmillan opened this issue Jan 16, 2025 · 0 comments
Open
8 tasks

DB Optimizations - Service SMS Sender #2253

k-macmillan opened this issue Jan 16, 2025 · 0 comments

Comments

@k-macmillan
Copy link
Member

k-macmillan commented Jan 16, 2025

User Story - Business Need

Reducing the number of queries against our data is necessary to maintain a stable product. Service SMS Sender is not something that changes very often and can safely be cached. We also want to fix a variable and function that are named improperly.

  • Ticket is understood, and QA has been contacted (if the ticket has a QA label).

User Story(ies)

As a VA Notify reliability dev
I want to reduce unnecessary DB calls
So that our db is only used when necessary

Additional Info and Resources

get_reply_to_text in app/v2/notifications/post_notifications.py is where the Service SMS Senders are looked up. The check_service_sms_sender_id is already cached, so this issue should handle the case where the template gathers the service's default sms sender. This may involve a new method that does not use the TemplateBase.get_reply_to_text, up to the dev.

Acceptance Criteria

  • check_service_sms_sender_id renamed to get_service_sms_sender_number
  • sms_sender_id in the get_reply_to_text method renamed to sms_sender_number
  • Uses a dataclass for the necessary fields
  • Uses @cached(cache=TTLCache(maxsize=1024, ttl=600))
  • Email is untouched
  • 10 notifications sent using the same provider should query the database at most once per worker
  • This work is added to the sprint review slide deck (key win bullet point and demo slide)

QA Considerations

Should be no difference for end-users.

Potential Dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants