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

Risk of slow order processor #22

Open
loevgaard opened this issue Jan 16, 2021 · 1 comment
Open

Risk of slow order processor #22

loevgaard opened this issue Jan 16, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@loevgaard
Copy link
Member

On this line: https://github.com/Setono/SyliusShopTheLookPlugin/blob/master/src/OrderProcessor/LookDiscountOrderProcessor.php#L46, all the looks are fetched on each processing of the order. If a shop has thousands of looks this will slow down the order processor.

A possible solution is to find the looks that have one or more of the products that are also in the cart. This way you have a set of 'candidate' looks that you can iterate through afterwards.

@loevgaard loevgaard added the enhancement New feature or request label Jan 16, 2021
@loevgaard
Copy link
Member Author

loevgaard commented Jan 17, 2021

Here is a query that will fetch the candidates:

SELECT l.* FROM setono_sylius_shop_the_look__look l
JOIN setono_sylius_shop_the_look__look_part p ON (l.id = p.look_id)
JOIN setono_sylius_shop_the_look__look_part_products pp ON (p.id = pp.look_part_id)
WHERE pp.product_id IN (:product_ids)
AND l.is_enabled = 1

In this case the variable :product_ids should contain the product ids in the cart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant