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

Remove fetching of Realm notifications from /realms/slug/{realm_name} endpoint #162

Open
3 of 7 tasks
essential-randomness opened this issue Nov 30, 2023 · 0 comments
Open
3 of 7 tasks
Assignees
Labels
📦 boba-backend An issue that involves the boba-backend repository ⏩ Implementation A feature that's currently being implemented 🚢 Large 🤸‍♂️ Teamwork welcome An issue made of many small parts that can be tackled by multiple people independently

Comments

@essential-randomness
Copy link
Collaborator

essential-randomness commented Nov 30, 2023

Problem

Fetching of Realm notifications is really slow and needs to be redesigned. Luckily, we already did some work splitting the "realm data fetching" endpoint (/realms/slug/{realm_name}) and the "realm notifications" endpoint (/realms/{realm_id}/notifications). However, the data fetching endpoint still uses the query that also fetches notifications, which is less than ideal.

Let's fix that!

The Players

  • getRealmBoards is our entry point into the infamous "white whale query", the worst performing boba query that we have declared unfixable.
  • This function is used in all realm data fetching queries, even the ones that don't need notifications.
  • Likely, this wasn't changed even when I split the two endpoints cause I didn't want to redo the tests. I suspect that's going to be the "PITA" part of this fix.

Step by Step

  • Zod the getRealmBoards query as data comes out of the database
  • Zod the /realms/slug/{realm_name} endpoint
  • Zod the /realms/{realm_id}/notifications endpoint
  • Create a new (immediately-zodded) database query that gets all the boards in the realm with only the data effectively needed by the /realms/slug/{realm_name} endpoint
  • Switch out the /realms/slug/{realm_name} endpoint to use that query
  • Fix all tests (sorry)

Stretch

  • Figure out if the getRealmBoards query is used in other parts of the codebase that don't need it.

The Future

While this gets fixed we'll be working on improving the performance of the notifications query by leveraging Redis.

@essential-randomness essential-randomness changed the title Remove fetching of Re Remove fetching of Realm notifications from /realms/slug/{realm_name} endpoint Nov 30, 2023
@essential-randomness essential-randomness added 🚢 Large ⏩ Implementation A feature that's currently being implemented 📦 boba-backend An issue that involves the boba-backend repository 🤸‍♂️ Teamwork welcome An issue made of many small parts that can be tackled by multiple people independently labels Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 boba-backend An issue that involves the boba-backend repository ⏩ Implementation A feature that's currently being implemented 🚢 Large 🤸‍♂️ Teamwork welcome An issue made of many small parts that can be tackled by multiple people independently
Projects
None yet
Development

No branches or pull requests

2 participants