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

Read Promoted Group Information Via Models #23082

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

chrstinalin
Copy link
Contributor

Fixes: mozilla/addons#15350

Description

Reads promoted group information via models.

Context

Testing

Checklist

  • Add #ISSUENUM at the top of your PR to an existing open issue in the mozilla/addons repository.
  • Successfully verified the change locally.
  • The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
  • Add before and after screenshots (Only for changes that impact the UI).
  • Add or update relevant docs reflecting the changes made.

@chrstinalin chrstinalin marked this pull request as draft February 14, 2025 22:45
@chrstinalin chrstinalin force-pushed the #15350-read-promoted-models branch 3 times, most recently from ef58b87 to d3fe342 Compare February 18, 2025 20:40
Comment on lines -1052 to +1091
with self.assertNumQueries(0):
result = self.serializer.to_representation(obj)
return result
return self.serializer.to_representation(obj)
Copy link
Member

Choose a reason for hiding this comment

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

I know this is just a draft & not finished yet, but FYI, the search & autocomplete APIs handle a lot of our traffic and should never execute any database queries. We shouldn't ship a change that would regress this assertNumQueries(0) assertion and the one below, they are important to keep.

Comment on lines -7171 to +7173
with self.assertNumQueries(0):
response = self.client.get(url, data, **headers)
response = self.client.get(url, data, **headers)
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned above, search should never execute database queries.

@chrstinalin chrstinalin force-pushed the #15350-read-promoted-models branch 3 times, most recently from 5f12b66 to 36ded4b Compare February 28, 2025 19:21
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.

[Task]: Read promoted group properties for multiple promoted groups
2 participants