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

Use .take in admin promotion index template #3224

Merged
merged 1 commit into from
Jun 13, 2019
Merged

Use .take in admin promotion index template #3224

merged 1 commit into from
Jun 13, 2019

Conversation

DianeLooney
Copy link
Contributor

@DianeLooney DianeLooney commented Jun 11, 2019

Description

.first executes an ordered query. This causes noticeable performance issues
with millions of promotions codes. .take simply returns the first element the
database can find. Since there is the guard clause for size == 1, in this
case .take is just a faster .first.

The issue is reported here, and contains more details / rationale:

#3223

Tests are not provided due to the difficulty in re-creating production-scale performance issues in a test environment.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)

`.first` executes an ordered query. This causes noticeable performance issues
with millions of promotions codes. `.take` simply returns the first element the
database can find. Since there is the guard clause for `size == 1`, in this
case `.take` is just a faster `.first`.
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for that 🎉

Cannot imagine a good test either. I say that's fine.

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks, this makes total sense. I'm fine not having a test around this specific change as well, as long as previous ones pass we should be fine.

Copy link
Contributor

@jacobherrington jacobherrington left a comment

Choose a reason for hiding this comment

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

Great change! Thanks for making a PR @DianeLooney! 🚀

@kennyadsl kennyadsl merged commit 92dc9e3 into solidusio:master Jun 13, 2019
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.

4 participants