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

[Perf] allow some requests to not require loading the cart #1804

Open
dkarlovi opened this issue Nov 29, 2021 · 5 comments
Open

[Perf] allow some requests to not require loading the cart #1804

dkarlovi opened this issue Nov 29, 2021 · 5 comments

Comments

@dkarlovi
Copy link
Contributor

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes

In 2.2.x, CoreShop\Bundle\CoreBundle\EventListener\RequestCartAvailability::checkCartAvailability will skip loading the cart in specific cases (like the route being _wdt, etc).

What would be useful here is to actually abstract this: allow developers to opt out of the cart requirement, meaning they could basically serve some requests without any database queries (if combined with #1803), this being an important property for very busy shops, for ESI fragments (Varnish) or requests which should be "realtime" (like search autocompletion).

@dpfaffenbauer
Copy link
Member

Any concrete ideas?

@dkarlovi
Copy link
Contributor Author

@dpfaffenbauer yes: currently there are some items which are fetched in event listeners, regardless if they'll be required or not, this also applies to #1803.

We should instead aim to fetch / set those things just in time, as in if we know for sure they'll be required. Maybe we have some factory based magic for the cart? Meaning we only fetch it if the code requests it to begin with?

@dpfaffenbauer
Copy link
Member

CartAvailability could be replaced with a change in the CartContext for example.

@dkarlovi
Copy link
Contributor Author

Yes, this could be done in general for other listeners too. Generally, any expensive operation should be done after an (implicit or explicit) opt-in, not opt-out.

@dkarlovi
Copy link
Contributor Author

Note, this also applies to \CoreShop\Bundle\CoreBundle\EventListener\RequestCartRecalculation::checkPriceRuleState

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants