Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Decorating the UserCartRecalculationListener#682

Merged
mamazu merged 7 commits into
Sylius:masterfrom
JakobTolkemit:fix_cart_recalculation
Nov 9, 2020
Merged

Decorating the UserCartRecalculationListener#682
mamazu merged 7 commits into
Sylius:masterfrom
JakobTolkemit:fix_cart_recalculation

Conversation

@JakobTolkemit
Copy link
Copy Markdown

With this the UserCartRecalculationListener listens to lexik_jwt_authentication.on_jwt_created instead of security.interactive_login, recalculating the cart only on an actual login.

Fixes: #667 #681

@JakobTolkemit JakobTolkemit requested a review from a team as a code owner October 29, 2020 14:10
Comment thread src/EventListener/UserCartRecalculationListener.php Outdated
Comment thread src/EventListener/UserCartRecalculationListener.php Outdated
Comment thread src/Resources/config/services/listener.xml Outdated
Comment thread src/Resources/config/services/listener.xml Outdated
Comment thread src/Resources/config/services/listener.xml Outdated
Comment thread src/Resources/config/services/listener.xml Outdated
Comment thread src/EventListener/UserCartRecalculationListener.php Outdated
Comment thread src/EventListener/UserCartRecalculationListener.php Outdated
Comment thread src/EventListener/UserCartRecalculationListener.php Outdated
Comment thread src/Resources/config/services/listener.xml Outdated
@diimpp
Copy link
Copy Markdown
Member

diimpp commented Nov 4, 2020

This doesn't solve #667, which prime reason are concurrent frontend calls, not internal over-use of order processing.

As for #681, personally I consider it undesirable side effect and that stateless shop-api shouldn't offer this functionality at all, moreover if a proper stateless cart context would be implemented, then this feature will never be called.

Though for the sake of a bit less broken shop-api plugin it can be done this way for 1.*

@JakobTolkemit JakobTolkemit removed the request for review from a team November 5, 2020 07:35
Comment thread src/Resources/config/services/event_listener.xml Outdated
Comment thread src/Resources/config/services/event_listener.xml
Comment thread src/Resources/config/services/event_listener.xml
Comment thread src/Resources/config/services/event_listener.xml
Copy link
Copy Markdown
Member

@diimpp diimpp left a comment

Choose a reason for hiding this comment

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

Thank you, Jakob.

@mamazu @lchrusciel guys, if you agree with the approach, let's not marinate this issue for months :)

use Sylius\Component\Order\Context\CartContextInterface;
use Sylius\Component\Order\Context\CartNotFoundException;
use Sylius\Component\Order\Processor\OrderProcessorInterface;
use Symfony\Contracts\EventDispatcher\Event;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
use Symfony\Contracts\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\Event;

Or we should probably add contracts to composer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, now I see it... #682 (comment) What would you say for using JWT class explicitly?

Also, can we maybe make it explicit, that we are removing service from the container (for example in CompilerPass with link to issue on Github) and declare separate service? Or at least link in the comment that is right now, to current issues on Github?

Comment thread src/EventListener/UserCartRecalculationListener.php
@JakobTolkemit JakobTolkemit force-pushed the fix_cart_recalculation branch 2 times, most recently from c20024a to 1816a3e Compare November 9, 2020 07:56
@mamazu mamazu merged commit 942e72f into Sylius:master Nov 9, 2020
@mamazu
Copy link
Copy Markdown
Contributor

mamazu commented Nov 9, 2020

Thanks, Jakob! 🥇

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cart runs in a deadlock on multiple calls

4 participants