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

[CORL-3172] optimized redis query for counts v2 endpoint #4660

Merged

Conversation

nick-funk
Copy link
Contributor

What does this PR do?

  • Replaces the multiple async mget promises with a singular redis mget with multiple key returns.
  • Replaces the multiple async await with an optimized for loop

These changes will impact:

  • commenters
  • moderators
  • admins
  • developers

What changes to the GraphQL/Database Schema does this PR introduce?

None

Does this PR introduce any new environment variables or feature flags?

No

If any indexes were added, were they added to INDEXES.md?

N/A

How do I test this PR?

  • Start up Coral
  • Query the counts v2 endpoint with some storyID's
  • See that it only makes one call to Redis to retrieve the storyID's

Were any tests migrated to React Testing Library?

No

How do we deploy this PR?

nick-funk and others added 30 commits May 24, 2024 11:58
only shows if Tenor is toggled in `Admin > Config`, otherwise
it uses Giphy
…-origin

      [CORL-3177]: update to grab the ORIGIN from the count.js script for
allows us to use the familiar g, pg, pg-13, r values everywhere
and just map them from 1-4 for tenor when necessary.
Copy link

netlify bot commented Sep 10, 2024

Deploy Preview for gallant-galileo-14878c canceled.

Name Link
🔨 Latest commit 1993320
🔍 Latest deploy log https://app.netlify.com/sites/gallant-galileo-14878c/deploys/66e08692efcd710008bc2b51

@nick-funk nick-funk changed the base branch from develop to feat/CORL-3172-counts-endpoint September 10, 2024 17:49
- avoid repeating string key interp everywhere
}
})
const redisCounts = await redis.mget(
...storyIDs.map((id) => computeCountKey(tenant.id, id))
Copy link
Contributor Author

@nick-funk nick-funk Sep 10, 2024

Choose a reason for hiding this comment

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

redis really likes it when you ask for everything all at once, its scheduler is great at grabbing n-many keys and returning it in a fast serialized payload!

Copy link
Contributor

@kabeaty kabeaty left a comment

Choose a reason for hiding this comment

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

Nice!

@nick-funk nick-funk merged commit da13776 into feat/CORL-3172-counts-endpoint Sep 10, 2024
1 check failed
@nick-funk nick-funk deleted the feat/CORL-3172-optimized-redis-query branch September 10, 2024 18:57
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.

5 participants