@@ -55,8 +55,6 @@ class QuoteManagement implements CartManagementInterface, ResetAfterRequestInter
55
55
{
56
56
private const LOCK_PREFIX = 'PLACE_ORDER_ ' ;
57
57
58
- private const LOCK_TIMEOUT = 10 ;
59
-
60
58
/**
61
59
* @var EventManager
62
60
*/
@@ -615,13 +613,12 @@ protected function submitQuote(QuoteEntity $quote, $orderData = [])
615
613
);
616
614
617
615
$ lockedName = self ::LOCK_PREFIX . $ quote ->getId ();
618
- if ($ this ->lockManager ->isLocked ($ lockedName )) {
616
+ if (! $ this ->lockManager ->lock ($ lockedName, 0 )) {
619
617
throw new LocalizedException (__ (
620
618
'A server error stopped your order from being placed. Please try to place your order again. '
621
619
));
622
620
}
623
621
try {
624
- $ this ->lockManager ->lock ($ lockedName , self ::LOCK_TIMEOUT );
625
622
$ order = $ this ->orderManagement ->place ($ order );
626
623
$ quote ->setIsActive (false );
627
624
$ this ->eventManager ->dispatch (
@@ -632,11 +629,11 @@ protected function submitQuote(QuoteEntity $quote, $orderData = [])
632
629
]
633
630
);
634
631
$ this ->quoteRepository ->save ($ quote );
635
- $ this ->lockManager ->unlock ($ lockedName );
636
632
} catch (\Exception $ e ) {
637
- $ this ->lockManager ->unlock ($ lockedName );
638
633
$ this ->rollbackAddresses ($ quote , $ order , $ e );
639
634
throw $ e ;
635
+ } finally {
636
+ $ this ->lockManager ->unlock ($ lockedName );
640
637
}
641
638
return $ order ;
642
639
}
0 commit comments