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

Products: Decouple from taxonomy term generation #119

Open
coreymckrill opened this issue Mar 13, 2023 · 0 comments
Open

Products: Decouple from taxonomy term generation #119

coreymckrill opened this issue Mar 13, 2023 · 0 comments

Comments

@coreymckrill
Copy link
Contributor

Currently when generating products, each call to the generate method will in turn call the generate_term_ids method (twice, once for categories, once for tags), which may generate between 0 and 5 new taxonomy terms. That adds a lot of extra potential database queries, and can really slow down the product generation process.

There are a couple of different approaches we could take to mitigate this:

  1. Use the same strategy that the Orders generator takes. If there aren't any existing category and/or tag terms, just create products without them. If there are existing terms, randomly assign them as usual.
  2. Do create terms along with products, but create them all first, as a batch, and then randomly assign as usual.

I've already taken one step to address this issue with #117, so that term generation can be done as an entirely separate command before running generate products. The batch method in the Term class could also be used with approach 2 above.

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

No branches or pull requests

1 participant